Code前端首页关于Code前端联系我们

求一个超简单的php代码(求一个超简单的php代码)

terry 2年前 (2023-09-30) 阅读数 76 #PHP
文章标签 str_replace函数

本文目录一览:

  • 1、最简单 php 代码
  • 2、求一段简单php代码
  • 3、求很简单的PHP代码
  • 4、求写个比较简单的php登陆页面代码
  • 5、求php代码!!!!实现一个简单的功能。
  • 6、php最经典,最基础的代码,适合入门的

最简单 php 代码

?php

mysql_query("insert into guahao values('".$name."','".$nl."','".$shouji."','".$sname."','".$info."')");

?

求一段简单php代码

?php

echo"开头";

for($i=1;$i5;$i++)

{

$b = 'class'.$i;

echo $b;

}

echo"结尾";

?

或者

?php

for($i=1;$i5;$i++)

{

if($i==1) echo"开头";

$b = 'class'.$i;

echo $b;

if($i==1) echo"结尾";

}

?

//这不很简单吗

求很简单的PHP代码

?php

$folder="C:\wamp\www\d";

$fp=opendir($folder);

while(false!=$file=readdir($fp)){

    if($file!='.' $file!='..'){

        $file="$folder/$file";

        $arr_file[]=$file;

    }

}

if(is_array($arr_file)){

while(list($key,$value)=each($arr_file)){

echo $value;

        $key=file_get_contents($value);

$_patten = '/(1234567)/';

if (preg_match($_patten,$key)) {

$a= preg_replace($_patten,"7654321",$key);

file_put_contents($value, $a);

    }

    }

}

closedir($fp);

?

代码就敲到到这了,感觉有点头痛,正则替换的7654321,你可以定义strrev($1);

求写个比较简单的php登陆页面代码

index.php 录入页代码form id="form1" name="form1" method="post" action="login.php"

table width="400" border="0" align="center" cellpadding="1" cellspacing="1" class="tableborder"

tr

tddiv align="right"用户名:/div/td

td width="244"

input type="text" name="User_name" id="User_name" / /td

/tr

tr

tddiv align="right"密 码:/div/td

tdinput type="Password" name="User_Password" id="User_Password" //td

/tr

tr

td

div align="right"

input type="submit" name="button" id="button" value="提交" /

/div/td

tdinput type="reset" name="button2" id="button2" value="重置" //td

/tr

/table

/form login.php提交页代码?

error_reporting(0);

$mysql_servername = "127.0.0.1";

$mysql_username = "root";

$mysql_password ="123456";

$mysql_database ="first";

mysql_connect($mysql_servername , $mysql_username , $mysql_password);

mysql_select_db($mysql_database);

$U_name=$_POST['user_name'];

$U_passowrd=$_POST['user_password'];

if ($U_name $U_passowrd){

$sql = "SELECT * FROM admin WHERE U_name = '$U_name' and U_password='$U_passowrd'";

$res = mysql_query($sql);

$rows=mysql_num_rows($res);

if($rows){

header("location='c.php'");

exit;

}

echo "script language=javascriptalert('用户名密码错误');history.back();/script";

}else {

echo "script language=javascriptalert('用户名密码不能为空');history.back();/script";

}

?

求php代码!!!!实现一个简单的功能。

最好不要用中文文件名

?

$content = file_get_contents('shuju.txt');

echo 'shuju.txt 内容:'.$content;

if(isset($_GET['action'])){

if($_GET['action']==1){

file_put_contents('open.txt','');

echo '创建打开.txt';

}elseif($_GET['action']==2){

file_put_contents('close.txt','');

echo '创建关闭.txt';

}

}

?

input type="button" value="打开" onclick="window.location='?action=1'"

input type="button" value="关闭" onclick="window.location='?action=2'"

php最经典,最基础的代码,适合入门的

PHP是一种可以嵌入到HTML中的运行在服务器端的脚本语言,所以为了体现PHP的特性我们可以分两种模式来实现PHP代码

1、 PHP嵌入到HTML中,例如index.php

html

head/head

body

    !--因为PHP嵌入到HTML中,所以需要完全区分PHP代码和HTML代码--

    ?php

        //输出hello world

        echo 'hello world;

    ?

/body

/html

2、 PHP独立文件,只有PHP代码,例如index.php

?php

    //输出

    echo 'hello world';

    

    //不需要闭合标签

版权声明

本文仅代表作者观点,不代表Code前端网立场。
本文系作者Code前端网发表,如需转载,请注明页面地址。

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

热门