-
php strtotime 函数使用方法
本文为大家讲解的是php中的strtotime函数的用法,strtotime函数可以用来返回指定日期格式的时间戳,感兴趣的同学参考下 int strtotime ( string time [, int now]) 本函数预期接受一个包含英文日期格式的字符串并尝试将其解析为 UNIX 时间戳。 如果 time 的格式是绝对时间则 now 参数不起作用...
PHP 2014-12-13 06:09:03 -
php错误: file_put_contents(xxxx) [function.file-put-contents]: failed to open stream: Permission denied in原因及解决方法
PHP 错误: file_put_contents(xxxx) [function.file-put-contents]: failed to open stream: Permission denied in 原因: file_put_contents函数在向指定文件写入数据时权限不足写入失败 解决方法: 修改被写入的文件权限,如果是自动创建的文件,则目录没有权限,需要把目录赋予可写权限 linux下 chmod -R 777 ...
PHP 2014-12-13 03:42:03 -
PHP Warning: include() [function.include]: Failed opening '/xxxx.php' for inclusion (include_path='.:/xxx/xxx/php/lib/php') in xxx.php解决方法
PHP 提示错误: include() [function.include]: Failed opening '/xxxx...
PHP 2014-12-13 03:33:04 -
PHP Warning: mkdir() [function.mkdir]: Permission denied in解决方法
php在调用用mkdir时出错PHP Warning: mkdir() [function.mkdir]: Permission denied in 原因: 权限不足不能执行创建目录命令 解决方法: 修改父级目录权限为0777即可 linux: chmod -R 777 ...
PHP 2014-12-13 02:45:05 -
php中运用http(curl)调用的GET和POST方法示例
本文为大家讲解的是php中用curl调用的GET和POST方法,使用到的函数是curl_init, curl_setopt, curl_exec,curl_close,默认是GET方法,感兴趣的同学参考下. 使用到的函数是curl_init, curl_setopt, curl_exec,curl_close。 默认是GET方法,可以选择是否使用Header: $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "$url"); curl_setopt($ch, CURLOPT_TIMEOUT, 2); curl_setopt($ch, CURLOPT_HEADER, 1); //如果设为0,则不使用header curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); $result = curl_exec($ch); curl_close($ch); POST方法: $ch = curl_init(); curl_setopt...
PHP 2014-12-13 02:42:03 -
PHP Warning: include(xxx.php) [function.include]: failed to open stream: Permission denied in原因及解决方法
php提示错误:PHP Warning: include(xxx.php) [function...
PHP 2014-12-13 02:30:06 -
php escape URL编码函数
本文是一个php实现的url 编码函数,既:php版的escape/unescape函数,感兴趣的同学参考下. php提供的URL编码函数是基于字节的,对由ie的javascript函数escape编码的数据就无能为力了。 function escape($str) { preg_match_all("/[x80-xff].|[x01-x7f]+/",$str,$r); $ar = $r[0]; foreach($ar as $k=>$v) { if(ord($v[0]) < 128) $ar[$k] = rawurlencode($v); else $ar[$k] = "%u".bin2hex(iconv("GB2312","UCS-2",$v)); } return join("",$ar); } function unescape($str) { $str = rawurldecode($str); preg_match_all...
PHP 2014-12-13 00:45:15 -
php URL编码解码
本文为大家讲解的是php下实现url编码和解码的方法,分别用了urlencode和urldecode函数,感兴趣的同学参考下. <?php $url = "http://www...
PHP 2014-12-12 19:00:09 -
PHP Google的translate API代码
本文是一个php实现的调用google翻译的工具,可以用来翻译英文,感兴趣的同学参考下. header("Content-Type: text/html; charset=utf-8"); class Google_API_translator{ public $opts = array("text" => "", "language_pair" => "en|it"); public $out = ""; function setOpts($opts) { if($opts["text"] != "") $this->opts["text"] = $opts["text"]; if($opts["language_pair"] != "") $this->opts["language_pair...
PHP 2014-12-12 15:57:06 -
php通过curl实现get和post的代码
本文为大家讲解的是php通过curl实现get和post的代码,感兴趣的同学参考下. 类似于dreamhost这类主机服务商,是显示fopen的使用的。使用php的curl可以实现支持FTP、FTPS、HTTP HTPPS SCP SFTP TFTP TELNET DICT FILE和LDAP...
PHP 2014-12-12 15:18:19 -
php 使用strlen mb_strlen计算中英文混排字符串长度
本文为大家讲解了php使用strlen mb_strlen函数计算中英文混排字符串长度的方法,感兴趣的同学参考下. 在php中常见的计算字符串长度的函数有:strlen和mb_strlen,下面是对这两个函数的比较说明(编码方式UTF8) 比较strlen和mb_strlen 当字符全是英文字符的时候,两者是一样。这里主要比较一下,中英文混排的时候,两个计算结果...
PHP 2014-12-12 09:03:07 -
php ignore_user_abort与register_shutdown_function 使用方法
本文为大家讲解了php 中的ignore_user_abort与register_shutdown_function 函数的使用方法,感兴趣的同学参考下. 语法: int ignore_user_abort(int [setting]); 返回值: 整数 函数种类: PHP 系统功能 内容说明 0 - NORMAL(正常)1 - ABORTED(异常退出)2 - TIMEOUT(超时) 本函数配置或取得使用端连接中断后,PHP 程序是否仍继续执行。默认值为中断连接后就停止执行...
PHP 2014-12-11 23:03:08