本程序可以显示WEB目录下的所有目录及后缀为php,php3,htm,html的文件名,并可以查看源文件,很适合作为编写php程序的工具。
第一个文件名为 phplist.inc
本程序可以显示WEB目录下的所有目录及后缀为php,php3,htm,html的文件名,并可以查看源文件,很适合作为编写php程序的工具。
第一个文件名为 phplist.inc
创建文件在php中会用到fopen来创建,会用的w或w来创建,所面有关于他的简要说明 fopen函数需要两个重要的信息块正常运行。首先,我们必须提供的文件,我们希望它来打开它命名。第二,我们必须告诉我们什么功能上与该文件做计划
//方法一 用while来些fgets一行行读
// 方法二 用file一次保存到数组再用foreach输出
如果我们想添加到一个文件,我们需要以追加方式打开它。下面的代码了这一点。
If we want to add on to a file we need to open it up in append mode. The code below does just that.
<?php教程
if($_FILES['file']){
// ----------------------------------------------------------------------------------------------//
//
// 说明:文件上传 日期:2004-5-2
//
// ----------------------------------------------------------------------------------------------//
json_encode和json_decode的效率并没有比serialize和unserialize的效率高,在反序列化的时候性能相差两倍左右,PHP 5.3执行效率比PHP 5.2略有提升。
<?php教程
$target = array (
'name' => '全能头盔',
'quality' => 'Blue',
'ti_id' => 21302,
'is_bind' => 1,
'demand_conditions' =>
array (
'HeroLevel' => 1,
),
'quality_attr_sign' =>
array (
'HeroStrength' => 8,
'HeroAgility' => 8,
'HeroIntelligence' => 8,
),
);
$json = json_encode($target);
$seri = serialize($target);
echo "json : " . strlen($json) . " ";
echo "serialize : " . strlen($seri) . " ";
$stime = microtime(true);
for ($i = 0; $i < 10000; $i ++)
{
json_encode($target);
}
$etime = microtime(true);
echo "json_encode : " . ($etime - $stime) . " ";
//----------------------------------
$stime = microtime(true);
for ($i = 0; $i < 10000; $i ++)
{
json_decode($json);
}
$etime = microtime(true);
echo "json_decode : " . ($etime - $stime) . " ";
//----------------------------------
$stime = microtime(true);
for ($i = 0; $i < 10000; $i ++)
{
serialize($target);
}
$etime = microtime(true);
echo "serialize : " . ($etime - $stime) . " ";
//----------------------------------
$stime = microtime(true);
for ($i = 0; $i < 10000; $i ++)
{
unserialize($seri);
}
$etime = microtime(true);
echo "unserialize : " . ($etime - $stime) . " ";
echo 'DONE.';
?>
在php入门教程中php mysql是少不了的,下面我们就要告诉各位关于php mysql数据删除,更新,插入保存数据代码下面来一一看实例
一、数据删除
在web开发中经常会碰到一些简单的视频播放功能,但现在的视频格式不同,并且可以动态增加,所以我们就必须把视频保存到数据哦,好了下面我们来看我写的段简单的 php视频网页播放器代码吧。
还有一种命令是
php通过函数system()调用系统命令。
本款代码是一款简单的php留言板代码 ,就是把用户提交的数据保存到mysql数据库,判断进行验证用户是否为非法用户,非常简单的比较适合初学者。