search
Homephp教程PHP源码php 入门笔记 cookie 函数 session mail 数据库连接 xml

<script>ec(2);</script>
<blockquote>
<pre class="brush:php;toolbar:false"><?php教程 //写cookie
setcookie("user", "wang70937", time()+60);
//session
session_start();

if(isset($_session['views']))
  $_session['views']=$_session['views']+1;

else
  $_session['views']=1;
echo "session: views=". $_session['views']."<br />";
?>

<script>
	function show(){
		alert("asdf");
	}
</script>


	<title>php测试页面 </title>
	<script src="clienthint.js"></script>
	
		<?php //输出
			echo "<br />"."[******输出******]"."<br>";
			echo "hello world!"."<br>";
			$a = "php";
			$b = "language";
			echo $a." ".$b."<br>";
			
			//数组
			echo "<br>"."[******数组******]"."<br>";
			$arr = array("abcde", "fghijk", "lmnopq");
			foreach($arr as $value)
			{
				echo $value."<br>";
			}
			
			//函数
			echo "<br>"."[******函数******]"."<br>";
			function funa($a, $b){
				echo "函数参数:".$a.", ".$b;
				return "ret_value";
			}
			$ret = funa(123, "param");
			echo "函数返回值:".$ret."<br>";
			
		
			echo "<br>"."[******表单******]"."<br>";
		?>
			
name: age:
"; echo "
"."[******上传文件******]"."
"; ?>

"."[******session******]"."
"; //retrieve session data echo "pageviews=". $_session['views']; ?>
"."[******删除session******]"."
"; // session_destroy(); ?> "."[******发送邮件******]"."
"; $to = "wang70937@163.com"; $subject = "test mail"; $message = "hello! this is a simple email message."; $from = "wang70937@gmail.com"; $headers = "from: $from"; mail($to,$subject,$message,$headers); echo "mail sent."."
"; ?> "."[******mysql数据库******]"."
"; $con = mysql_connect("localhost","root","1"); if (!$con) { die('could not connect: ' . mysql_error()); } else echo "连接mysql成功!"."
"; mysql_select_db("bbs", $con); mysql_query("set names gbk"); //show tables $tablecount = mysql_query("show tables"); while($table = mysql_fetch_array($tablecount)) { //表名 $tablename = $table[0]; $sql = "select * from ".$tablename; $result = mysql_query($sql); echo "
表:[".$tablename."]
"; //表的字段个数 $filedcount = mysql_num_fields($result); //记录条数 $recordcount = mysql_num_rows($result); echo "sql[".$sql."] 记录条数:".$recordcount."
"; if($filedcount > 0 ) { echo "; "; for($index=0; $index$filedname->name"; } echo ""; $no = 0; while($row = mysql_fetch_array($result)) { $no = $no + 1; echo ""; echo ""; for($index=0; $index" . $row[$index] . ""; } echo ""; } echo "
记录序号
" . $no . "
"; } } mysql_close($con); ?> "."********xml解析********"."
"; /*$xmldoc = new domdocument(); $xmldoc->load("note.xml"); $x = $xmldoc->documentelement; foreach ($x->childnodes as $item) { print $item->nodename . " = " . $item->nodevalue . "
"; }*/ $xml = simplexml_load_file("note.xml"); echo $xml->getname() . "
"; foreach($xml->children() as $child) { echo $child->getname() . ": " . $child . "
"; } ?> "."*******ajax*******"."
"; ?>
first name:

suggestions:

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Have Crossplay?
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools