您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
免费发信息

PHP 的一些不太常用的特性

2024/4/24 2:50:22发布6次查看
1. 变量函数名,可以用字符串拼接函数名
function aa($str) {
 echo $str;}$function = aa;$function('hello');// orcall_user_func($function, $param);
2. 列出所有函数,判断某个函数是否存在
get_defined_functions()function_exist()
3. 接受 put 请求,php rest 必备
parse_str(file_get_contents('php://input'), $put_vars);
4. 从字符串解析时间
echo date('y-m-d', strtotime('-1 month ago'));
5. debug 查看调用 backtrace
$backtrace = debug_backtrace();var_export($backtrace[0])die();
6. 交互式命令行,命令行执行 php
php -a 和 php -r ‘echo “hello”;’
更多请看 php -h
7. 内存使用检测
memory_get_peak_usage()memory_get_usage()
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录