![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
PHP函数整理
fjnjxr
这个作者很懒,什么都没留下…
展开
-
Uncaught Error: Function name must be a string
问题:在写php代码的时候,误将代码$_GET[""]方法写错了.写成了$_GET(""),即中括号写成了小括号,导致报错Uncaught Error: Function name must be a string解决:改成$_GET[""]原因: 写成$_GET(""),php首先会认为get()是一个方法,但是前面又多了$符号,php又认为这是一个变量,而变量名不能作为function的名字,所有会抛出"Function name must be a string"。...原创 2020-07-23 10:58:24 · 2274 阅读 · 0 评论 -
20180522 php常用函数复习array_reverse
array_reverse — 返回一个单元顺序相反的数组 array array_reverse ( array $array [, bool $preserve_keys = false ] )array_reverse() 接受数组 array 作为输入并返回一个单元为相反顺序的新数组。 参数array输入的数组。 preserve_keys如果设置...原创 2018-05-22 10:30:47 · 307 阅读 · 0 评论 -
Thinkphp自定义函数使用
在Thinkphp3.2.2中使用自定义函数,主要需要注意两个方面:一、函数文件的名称,需要命名为function.php二、function.php文件放置的位置 Application-->Common->Common->function.php然后在function文件中写自己的的自定义函数就可以了原创 2016-09-26 16:34:14 · 715 阅读 · 0 评论 -
file_get_contents()打开URL无法获得数据返回false原因
今天在写接口,使用file_get_contents()获得网页返回json数据过程中,总是无法获得数据,后来请教同事,前面必须添加http://,特此记录。原创 2016-09-23 15:33:21 · 10969 阅读 · 0 评论 -
在lnmp服务器用file_put_contents函数写入文件无法写入的解决方法
在lnmp服务器用file_put_contents函数写入文件总是无法成功,仔细查阅资料,发现问题出现在拥有者(属主)是root的问题,更改拥有者(属主)为nginx完美解决问题。原创 2016-10-09 16:21:42 · 5346 阅读 · 1 评论 -
pathinfo()函数详解
pathinfo() - 返回文件路径的信息适用版本: php4>=4.0.3 php5php7用法:mixed pathinfo ( string $path [, int $options = PATHINFO_DIRNAME | PATHINFO_BASENAME | PATHINFO_EXTENSION | PATHINFO_FILENAME ] )原创 2016-09-23 09:56:12 · 3772 阅读 · 0 评论 -
file_put_contents函数常用方法
1、file_put_contents(PHP 5, PHP 7)file_put_contents — 将一个字符串写入文件int file_put_contents (string $filename , mixed$data [, int$flags = 0 [,resource $context ]] )和依次调用 fopen()原创 2016-08-25 09:34:51 · 2644 阅读 · 0 评论 -
preg_replace的使用方法
preg_replace —执行一个正则表达式的搜索和替换说明mixedpreg_replace( mixed$pattern , mixed$replacement , mixed$subject [, int $limit = -1 [, int &$count ]] )搜索subject中匹配pattern的部分, 以r原创 2016-08-24 17:17:36 · 1313 阅读 · 0 评论 -
str_replace的使用
str_replace —子字符串替换说明mixedstr_replace( mixed$search , mixed$replace , mixed$subject [, int &$count ] )该函数返回一个字符串或者数组。该字符串或数组是将 subject 中全部的search 都被 replace 替换之后的结果原创 2016-08-24 17:01:58 · 672 阅读 · 0 评论 -
json_decode使用
json_decode —对 JSON 格式的字符串进行编码说明mixedjson_decode( string $json [, bool $assoc = false [, int $depth = 512 [, int $options = 0 ]]] )接受一个 JSON 格式的字符串并且把它转换为 PHP 变量原创 2016-08-24 16:52:07 · 2682 阅读 · 0 评论 -
preg_match_all函数详解
1、preg_match_all —执行一个全局正则表达式匹配int preg_match_all( string $pattern , string$subject [, array&$matches [, int $flags = PREG_PATTERN_ORDER [, int $offset = 0 ]]] )搜索subje原创 2016-08-24 14:52:15 · 1716 阅读 · 0 评论 -
substr函数使用
string substr( string $string , int $start [, int $length ] )返回字符串 string 由 start 和length 参数指定的子字符串。参数string 输入字符串。 start 如果 start 是非负数,返回的字符串将从 string 的 start 位置开始,从 0原创 2016-08-24 16:34:57 · 331 阅读 · 0 评论 -
PHP怎么获得当日零点的时间戳
今天项目中,想每天看到的是当天的全部信息,所以想获得当天零点的时间戳,复习下时间戳的相关知识,总结如下:<?phpheader("Content-type:text/html;charset=utf-8");//设置北京时间为默认时区date_default_timezone_set('PRC');//输出当前时间echo date("Y-m-d H:i:s"原创 2016-08-11 10:49:45 · 40462 阅读 · 2 评论