03 2016 档案
PHP文件上传设置和处理(单文件)
摘要:<!--upload.php内容--><?php /* 修改php.ini的设置 file_uploads必须是On upload_max_filesize 设置上传文件的大小,此值小于post_max_size post_max_size 设置POST方法可以接收的最大值 upload_tmp_d 阅读全文
posted @ 2016-03-31 21:53 奋斗的寒霜 阅读(279) 评论(0) 推荐(0)
PHP文件锁定机制
摘要:<?php //如果多用户访问一个文件,采用文件锁定机制 /* flock()文件锁定 */ header("Content-Type:text/html;charset=utf8"); $filename = "message.txt"; //如果用户提交了, 就写入文件, 按一定格式写入 if( 阅读全文
posted @ 2016-03-31 20:51 奋斗的寒霜 阅读(382) 评论(0) 推荐(0)
PHP简单留言板
摘要:<?php header("Content-Type:text/html;charset=utf8"); $filename = "message.txt"; //如果用户提交了, 就写入文件, 按一定格式写入 if(isset($_POST['dosubmit'])) { //字段的分隔使用||, 阅读全文
posted @ 2016-03-31 20:38 奋斗的寒霜 阅读(273) 评论(0) 推荐(0)
文件的内容操作
摘要:<?php//打开,追加方式$fp = fopen("demo.txt", "a"); rewind($fp);echo ftell($fp)."<br>";//默认在文件末尾追加fwrite($fp, "hello world\n");//关闭fclose($fp); //打开$fp = fope 阅读全文
posted @ 2016-03-28 20:54 奋斗的寒霜 阅读(146) 评论(0) 推荐(0)
文件的打开和关闭
摘要:<?php/* * fopen("位置URL", "mode"); * */ //打开$fp = fopen("tmp.txt", "r+"); //关闭fclose($fp); 阅读全文
posted @ 2016-03-28 20:34 奋斗的寒霜 阅读(145) 评论(0) 推荐(0)
文件一些基本操作函数
摘要:<?php //创建一个空文件 //touch("./feng.txt"); //复制文件 //copy("feng.txt", "meize.txt"); //移动或重新命名一个文件 //rename("meize.txt", "meizi.txt"); //删除一个文件 //unlink("me 阅读全文
posted @ 2016-03-28 20:15 奋斗的寒霜 阅读(175) 评论(0) 推荐(0)
PHP复制和移动目录
摘要:<?php //重命名一个文件或目录 rename("phpmyadmin", "phpadmin");//重命名成phpadmin /* * $dirsrc 原目录 * $dirto 目标目录 */ function copydir($dirsrc, $dirto) { //如果原来的文件存在, 阅读全文
posted @ 2016-03-27 20:42 奋斗的寒霜 阅读(829) 评论(0) 推荐(0)
PHP建立和删除目录
摘要:<?php/*linux中的文件权限filedir 用户 组 其它 rwx rwx rwx 读写执行 6 4 6 读写 读 读写 7 7 7 rw_ r__ rw_ r__ _w_ ___ r = 4 w = 2 x = 1 chmod 777 filename chmod 644 filename 阅读全文
posted @ 2016-03-27 20:30 奋斗的寒霜 阅读(294) 评论(0) 推荐(0)
PHP统计目录中文件个数和文件大小
摘要:<meta charset="utf-8"><?php $dirn = 0; //目录数 $filen = 0; //文件数 //用来统计一个目录下的文件和目录的个数 function getdirnum($file) { global $dirn; global $filen; $dir = op 阅读全文
posted @ 2016-03-27 20:13 奋斗的寒霜 阅读(1086) 评论(0) 推荐(0)
PHP目录文件遍历
摘要:<meta charset="utf-8"><?php //遍历文件中的所有文件名称 foreach(glob("phpmyadmin/*") as $filename ) { //echo $filename."<br>"; } //打开目录资源 $dir = opendir("phpmyadmi 阅读全文
posted @ 2016-03-27 17:54 奋斗的寒霜 阅读(248) 评论(0) 推荐(0)
PHP文件属性相关函数
摘要:<meta charset= "utf-8"><?php //获取文件属性的函数 function getFilePro($filename) { //检测文件是否存在 if(file_exists($filename)) { echo "这个文件存在<br>"; //检测是否是目录 if(is_d 阅读全文
posted @ 2016-03-26 21:16 奋斗的寒霜 阅读(706) 评论(0) 推荐(0)
PHP日历程序编写(简单实现)
摘要:<meta charset="utf-8"><?php $year = isset($_GET['year']) ? $_GET['year'] : date("Y"); //当前的年 $month = isset($_GET['month']) ? $_GET['month'] : date("m 阅读全文
posted @ 2016-03-26 17:50 奋斗的寒霜 阅读(3807) 评论(0) 推荐(0)
PHP应用日期与时间
摘要:<?php/* 时间戳 * * 1. 是一个整数 * 2. 1970-1-1 到现在的秒数 1213212121 * * 2014-02-14 11:11:11 * * 02/14/2014 11:11:11 * * */ date_default_timezone_set("PRC"); $sta 阅读全文
posted @ 2016-03-26 17:24 奋斗的寒霜 阅读(172) 评论(0) 推荐(0)
PHP异常处理
摘要:<meta charset="utf-8"><?php/* * try { * * } * * * catch(Exception $e) { * * } * * 1. try catch是一体 * 2. try catch之间不能有任何代码 * * 工作原理 * * 1. 试着执行try中的代码, 阅读全文
posted @ 2016-03-25 21:14 奋斗的寒霜 阅读(100) 评论(0) 推荐(0)
设置错误日志
摘要:<?php/* 1.前台报错关闭:在php.ini中display_error=Off * 2.日志开启记录功能开启:在php.ini中log_errors = On 3.如果想单独记录可以建立一个文件,修改php.ini中error_log = "c:/wamp/logs/php_error.lo 阅读全文
posted @ 2016-03-25 20:44 奋斗的寒霜 阅读(165) 评论(0) 推荐(0)
自定义PHP错误报告处理方式
摘要:<?php //在php中注册一个函数, 来处理错误报告, 而不按原来的方式处理了 set_error_handler("myerrorfun"); $mess = ""; //自己的错误报告处理函数 function myerrorfun($error_type, $error_message, 阅读全文
posted @ 2016-03-24 21:44 奋斗的寒霜 阅读(243) 评论(0) 推荐(0)
PHP错误报告
摘要:级别常量 错误值 错误报告描述 E_ERROR 1 致命的运行时错误(阻止脚本执行) E_WARNING 2 运行时警告(非致命性错误) E_PARSE 4 从语法中解析错误 E_NOTICE 8 运行时注意消息(可能是或可能不是一个问题) E_CORE_ERROR 16 PHP启动时初始化过程中的 阅读全文
posted @ 2016-03-24 21:28 奋斗的寒霜 阅读(185) 评论(0) 推荐(0)
PHP中的字符串替换(str_replace)
摘要:/*替换 字符串处理 str_replace() */ $num = 0; $str = "http://www.phpbrother.net/php/demo.php";$str1="这是一句正常的寒霜句子,错误但里面有一些不能显示的文字";//在$str里搜索php,替换成java$newstr 阅读全文
posted @ 2016-03-19 10:39 奋斗的寒霜 阅读(816) 评论(0) 推荐(0)
PHP字符串的替换(preg_replace)
摘要:/* 正则表达式 preg_replace() */ $str = array( "如果没有一些http://www.abc.com特殊的<b>替换</b>需5求(<u>比如正则表达式</u>),你应http://www.bcd.net该使用该http://bbs.brophp.org函数替9换 < 阅读全文
posted @ 2016-03-19 10:36 奋斗的寒霜 阅读(764) 评论(0) 推荐(0)
这是第一篇文章
摘要:只是想测试一下 阅读全文
posted @ 2016-03-18 21:22 奋斗的寒霜 阅读(100) 评论(0) 推荐(0)