php基础和常见问题.
摘要:错误提示:Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone i
阅读全文
摘要:下载phpmailer ,在程序里包含class.phpmailer.php 类 ,这里有中文乱码的解决方法实例代码如下 PHPMailer - Mail() basic test CharSet = "UTF-8"; //中文环境下需要设置编码 // $body = file_get_contents( 'contents.html' ); //包含网页的使用方法 //$body = eregi_replace( "[\]", '', $body ); $body = '测试邮...
阅读全文
摘要:(转载)作者:海底苍鹰地址:http://blog.51yip.com/php/1064.html1,exec函数查看复制打印?返回结果如下:查看复制打印?[root@krlcgcms01shell]#php./exec.phpArray([0]=>1001.log[1]=>10.log[2]=>10.tar.gz[3]=>aaa.tar.gz[4]=>mytest[5]=>test1101[6]=>test1102[7]=>weblog_2010_09)2,system函数查看复制打印?返回结果:[root@krlcgcms01shell]#p
阅读全文
摘要:本文引用来自http://hi.baidu.com/yflife/item/fd00ef142c5967fcdceeca84php 获取指定月最后一天:
阅读全文
摘要:本文转载自 http://jin541223.blog.163.com/blog/static/1637398052011111233018533///本周第一天(星期日为一周开始)echo date('Y-m-d', time()-86400*date('w'));//本周第一天(星期一为一周开始)echo date('Y-m-d', time()-86400*date('w')+(date('w')>0?86400:-6*86400));//本月第一天 echo date('Y-m-d',
阅读全文
摘要:本文引用自http://www.fengfly.com/plus/view-62827-1.html补0:
阅读全文
摘要:如果总是提示正在连接,ok,应该是没有装xdebug;1,下载Php版本对应的xdebug.dll文件,以下是官方提供的网址,可以智能判断环境,给出下载链接和使用指南http://www.xdebug.org/find-binary.php在输入框里,粘贴你的phpinfo()源码点击Analyse my phpinfo() output按钮即可;2.使用方式a.将下载好的.dll文件夹按照提示放入php/ext/文件夹下b.配置php.ini文件zend_extension=php_xdebug-2.1.0-5.3-vc6.dll ;(替换成刚下载的版本)xdebug.remote_enab
阅读全文
摘要:多是代码形式呈现,更多的信息可以查看php api文档,搜索Filesystem;//创建文件夹$path_find = AppRoot . '/Temp/excel_curl'; //查找的路径if ( !file_exists( $path_find ) ) { mkdir( $path_find, 0777, true );}//创建文件可以直接用file_put_contents,此函数会判断是否存在文件,不存在则创建.//删除文件unlink();//删除目录rmdir();//判断文件夹下有无文件1 if ( $handle = opendir( $path_fin
阅读全文
摘要:如果全局变量要在函数中使用,要加 global 声明, 第二种是利用PHP自带的$GLOBALS数组 请看如下代码:<?php$test = 0;//声明全局变量function demo(){global $test;//一定加上global;for($i = 0; $i<10;$i++){$test +=$i;//或者// GLOBLAS["test"] +=$i;}}demo();//调用demo()方法echo $test; //变量值已经改变echo $i;//这里会报一个错,不能找到$i,函数中的$i是局部变量,不能作用于函数外.?>
阅读全文
摘要:指定字符串后拼接如下字符"\r\n" windows格式换行"\n" Linux格式换行"\r" Mac格式换行新认识的函数 nl2br 的运用string nl2br ( string $string [, bool $is_xhtml = true ] )在字符串 string 所有新行之前插入 '<br />' 或 '<br>',并返回。 参数string输入字符串。is_xhtml是否使用 XHTML 兼容换行符。官方源码:<?phpecho nl2br("
阅读全文
摘要:这个是在window7平台下做的测试.不能解析中文目录,并报错.解决方案如下.$filePath = iconv("UTF-8","GB2312",'G:\小明.txt') ;$str =file_get_contents($filePath);这个要和操作系统的编码一致才行.
阅读全文