| 新手入门:初学动态网页PHP的18个例子 |
|
| |
|
|
<? $customer[0] = 'webjx'; $customer[1] = 'web'; $customer[2] = 'mutou'; $customer[3] = 'chuxia'; $customer[4] = 'shenhua'; echo "第3个用户是: $customer[2]";
echo "<br /><br />所有的用户:<br /><br />";
$number = 5; $x = 0; while ($x < $number) { $customernumber = $x + 0; echo "Costumer Name $customernumber is $customer[$x]<br />"; ++$x; } ?> 将会显示: The third customer is mutou
所有的用户:
Costumer Name 0 is webjx Costumer Name 1 is web Costumer Name 2 is mutou Costumer Name 3 is chuxia Costumer Name 4 is shenhua
另一种读取数组的方法:
<? echo "3 of my customer are: $customer[0], " . " $customer[1] and " . " $customer[2]. " . "<br />"; ?>
将会显示: 3 of my customer are: webjx, web and mutou.
十六.统计某个目录下文件的数量:
<? echo("There is "); $dir = "/path/to/the/folder/in/your/computer "; $count = 0; $handle=opendir($dir); while (($file = readdir($handle))!== false){ if ($file != "." && $file != "..") { $count++; }} echo $count;
echo(" Pages For You To Search In This Directory."); ?>
十七.显示当前日期或最新更新的日期:
<?php echo date("F d Y"); ?>
显示更新日期:
<?php echo "Last Modified: " . date ("m/d/y.", getlastmod());?>
十八.重复一个字符多次的代码:
<? echo str_repeat("-", 30); ?>
上一页 [1] [2]
 |
频道声明:本频道的文章除部分特别声明禁止转载的专稿外,可以自由转载.但请务必注明出出处和原始作者 文章版权归本频道与文章作者所有.对于被频道转载文章的个人和网站,我们表示深深的谢意。
| 原始作者:佚名 |
录入时间:2007-6-29 11:01:11 |
| 信息来源:不详 |
投稿信箱:itqoo@126.com |
|
|
 |
|
|
|
| 教程录入:itqoo 责任编辑:itqoo |
|
上一个教程: 总结:常见php页面漏洞分析及相关问题解决
下一个教程: 实例讲解PHP网站开发中Session的使用方法 |
| 【字体:小 大】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 |