-
php发送post请求示例代码
本文为大家讲解的是php发送post请求示例代码,感兴趣的同学参考下. function do_post_request($url, $data, $optional_headers = null) { $params = array('http' => array( 'method' => 'POST', 'content' => $data )); if ($optional_headers !== null) { $params['http']['header'] = $optional_headers; } $ctx = stream_context_create($params); $fp = @fopen($url, 'rb', false, $ctx); if (!$fp) { throw new Exception(&...
PHP 2014-12-17 07:36:04 -
PHP Catchable fatal error: Object of class * could not be converted to string错误解决方法
本文为大家讲解的是php错误:PHP Catchable fatal error: Object of class * could not be converted to string的解决方法,感兴趣的同学参考下。 错误: PHP Catchable fatal error: Object of class * could not be converted to string 原因: 单从字面上理解是对象不能转换为字符串,由于 object转换成 string 時才会发生这个严重错误(fatal error)...
PHP 2014-12-17 05:03:04 -
mysql错误:Access denied for user 'root'@'localhost' (using password: YES)解决方法
本文为大家讲解的是mysql错误:Access denied for user 'root'@'localhost' (using password: YES)解决方法,感兴趣的同学参考下. 错误描述 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 解决方案 windows环境 编辑mysql配置文件my.ini(不知道在哪请搜索),在[mysqld]这个条目下加入 skip-grant-tables 保存退出后重启mysql 1.点击“开始”->“运行”(快捷键Win+R)。 2.启动:输入 net stop mysql 3.停止:输入 net start mysql cmd mysql -u root -p 回车 如果在cmd下报...
数据库操作教程 2014-12-17 04:51:04 -
mysql错误: Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist原因及解决方法
本文为大家讲解的是mysql错误: Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist原因及解决方法,感兴趣的同学参考下. 错误描述 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist 错误原因 mysql 这个库不存在,所以导致数据库连接不上。 解决方法 把Mysql 安装目录下的 data 文件夹里的mysql文件夹 copy 到 数据库的存放路径中(从my.ini可以看到) ...
数据库操作教程 2014-12-17 04:39:03 -
PHP下获取上个月、下个月、本月的日期(strtotime,date示例)
本文为大家讲解的是PHP下获取上个月、下个月、本月的日期(strtotime,date示例),感兴趣的同学参考下. 今天写程序的时候,突然发现了很早以前写的获取月份天数的函数,经典的switch版,但是获得上月天数的时候,我只是把月份-1了,估计当时太困了吧,再看到有种毛骨悚然的感觉,本来是想再处理一下的,但是一想肯定还有什么超方便的方法,于是找到了下面这个版本,做了一点小修改。 获取本月日期: function getMonth($date){ $firstday = date("Y-m-01",strtotime($date)); $lastday = date("Y-m-d",strtotime("$firstday +1 month -1 day")); return array($firstday,$lastday); ...
PHP 2014-12-17 04:33:04 -
PHP 读取Postgresql中的数组
本文为大家讲解的是PHP 读取Postgresql中的数组,需要的朋友可以参考一下 function getarray_postgresql($arraystr) { $regx1 = '/^{(.*)}$/'; $regx2 = "/"((\\\\|\\"|[^"])+)"|[^,]+/"; $regx3 = '/^[^"].*$|^"(.*)"$/'; $match = null; preg_match( $regx1,$arraystr,$match); $str = $match[1]; &...
PHP 2014-12-16 23:48:08 -
php使用fsockopen函数发送post,get请求获取网页内容的方法
本文为大家讲解的是php使用fsockopen函数发送post,get请求获取网页内容的方法,感兴趣的同学参考下. 具体实现代码如下: $post =1; $url = parse_url($url); $host ='http://www...
PHP 2014-12-16 15:09:14 -
php截取字符串函数substr,iconv_substr,mb_substr示例以及优劣分析
本文为大家讲解的是php截取字符串函数substr,iconv_substr,mb_substr示例以及优劣分析,php进行中文字符串的截取时,会经常用到二个函数iconv_substr和mb_substr,对这二个函数应该如何选择呢?参考下本文介绍的例子就明白了。 示例代码,用到了函数substr与iconv_substr,mb_substr <html> <head><meta charset='utf-8'> <title>截取中文字符串_脚本之家_www.jb51.net</title> </head> <body> <?php $str='123phperz 456欢迎大家的光临'; echo substr($str,0,4); echo '<br>'; echo iconv_substr($str,0,4,'utf-8'); echo '<br>'...
PHP 2014-12-16 09:33:25 -
mysql中UNIX_TIMESTAMP()函数与php中time()函数的区别
本文为大家讲解的是mysql中UNIX_TIMESTAMP()函数与php中time()函数的区别,感兴趣的同学参考下。 mysql 中:UNIX_TIMESTAMP(), UNIX_TIMESTAMP(date) 若无参数调用,则返回一个Unix timestamp ('1970-01-01 00:00:00' GMT 之后的秒数) 作为无符号整数...
PHP 2014-12-16 07:00:07 -
php中$_REQUEST、$_POST、$_GET的区别和练习小结
本文为大家讲解的是php中$_REQUEST、$_POST、$_GET的区别和练习小结,感兴趣的同学参考下。 1. $_REQUEST php中$_REQUEST可以获取以POST方法和GET方法提交的数据,但是速度比较慢 2. $_GET 用来获取由浏览器通过GET方法提交的数据...
PHP 2014-12-16 06:06:04 -
PHP的cURL库功能简介 抓取网页、POST数据及其他
本文是PHP的cURL库功能简介 抓取网页、POST数据及其他应用示例讲解,感兴趣的同学参考下。 本文介绍了PHP的cURL库的几个使用方法...
PHP 2014-12-16 05:57:03 -
PHP时间戳 strtotime()函数使用方法和技巧详解
本文为大家讲解的是PHP时间戳 strtotime()函数使用方法和技巧详解,感兴趣的同学参考下. 在php中我想要获取时间戳有多种方法,最常用的就是使用time函数与strtotime()函数把日期转换成时间戳了,下面我来给大家分享一下时间戳函数 strtotime用法。 获取指定的年月日转化为时间戳: pHP时间戳函数获取指定日期的unix时间戳 strtotime('2012-12-7') 示例如下: <?php echo strtotime('2012-12-7'); //结果:1354838400 ?> 说明:返回2012年12月7日0点0分0秒时间戳...
PHP 2014-12-16 05:00:08