<?phpecho date("Y/m/d");echo "<br />";echo date("Y.m.d");echo "<br />";echo date("Y-m-d");?>
2006/07/112006.07.112006-07-11
<?php$tomorrow = mktime(0,0,0,date("m"),date("d")+1,date("Y"));echo "Tomorrow is ".date("Y/m/d", $tomorrow);
明天是 2006/07/12
<html><body><?php include("header.php"); ?><h1>Welcome to my home page</h1><p>Some text</p></body></html>
<html><body><a href="http://www.w3school.com.cn/default.php">Home</a> |<a href="http://www.w3school.com.cn/about.php">About Us</a> | <a href="http://www.w3school.com.cn/contact.php">Contact Us</a>三个文件,"default.php"、"about.php" 以及 "contact.php" 都引用了 "menu.php" 文件。这是 "default.php" 中的代码:<?php include("menu.php"); ?><h1>Welcome to my home page</h1><p>Some text</p></body></html>如果您在浏览器中查看 "default.php" 的源代码,应该类似这样:<html><body><a href="default.php">Home</a> |<a href="about.php">About Us</a> | <a href="contact.php">Contact Us</a><h1>Welcome to my home page</h1><p>Some text</p></body></html>
<html><body><?phpinclude("wrongFile.php");echo "Hello World!";?></body></html>错误消息:Warning: include(wrongFile.php) [function.include]:failed to open stream:No such file or directory in C:\home\website\test.php on line 5Warning: include() [function.include]:Failed opening 'wrongFile.php' for inclusion(include_path='.;C:\php5\pear')in C:\home\website\test.php on line 5Hello World!
<html><body><?phprequire("wrongFile.php");echo "Hello World!";?></body></html>错误消息:Warning: require(wrongFile.php) [function.require]:failed to open stream:No such file or directory in C:\home\website\test.php on line 5Fatal error: require() [function.require]:Failed opening required 'wrongFile.php'(include_path='.;C:\php5\pear')in C:\home\website\test.php on line 5由于在致命错误发生后终止了脚本的执行,因此 echo 语句不会执行。
联系客服