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 必备
立即学习“PHP免费学习笔记(深入)”;
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()
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号