失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > PHP输出当前进程所有变量/常量/模块/函数/类的示例【PHP】

PHP输出当前进程所有变量/常量/模块/函数/类的示例【PHP】

时间:2021-03-06 03:43:47

相关推荐

PHP输出当前进程所有变量/常量/模块/函数/类的示例【PHP】

后端开发|php教程

php

后端开发-php教程

1. get_defined_vars(PHP 4 >= 4.0.4, PHP 5) — 获取由所有已定义变量所组成的数组

array get_defined_vars ( void )

此函数返回一个包含所有已定义变量列表的多维数组,这些变量包括环境变量、服务器变量和用户定义的变量。

html打地鼠游戏源码,启动ubuntu卡bios,决策二包爬虫,php的π,礼物网站SEOlzw

<?php

echo

app源码之家官网,ubuntu根目录不足,tomcat7配置根目录,爬虫获取斗鱼人气,go能不能代替php,潭州seo视频lzw

;

$b = array(1,1,2,3,5,8);

$arr = get_defined_vars();

// 打印 $b

print_r($arr["b"]);

// 打印所有服务器变量

print_r($arr["_SERVER"]);

// 打印变量数组的所有可用键值

print_r(array_keys(get_defined_vars()));

?>

2. get_defined_functions(PHP 4 >= 4.0.4, PHP 5) — 获取所有已经定义的函数

array get_defined_functions ( void ) //void 表示为空,不需要任何参数

<?php

echo

源码编译器,ubuntu无法挂载位置,tomcat响应时间太长,自学爬虫项目,php类似codeql,抖音seo关键词排名技巧lzw

;

function foo()

{

echo "This is my function foo";

}

$arr = get_defined_functions();

print_r($arr);

?>

3. get_loaded_extensions(PHP 4, PHP 5) — 获取所有可用的模块

<?php

echo

;

print_r(get_loaded_extensions());

?>

4. get_extension_funcs(PHP 4, PHP 5) — 获取指定模块的可用函数

array get_extension_funcs ( string $module_name ) 该函数返回指定模块所有可用的函数。传入的参数(模块名称)必须是小写

<?php

echo

;

print_r(get_extension_funcs("gd"));

print_r(get_extension_funcs("xml"));

?>

5. get_defined_constants(PHP 4 >= 4.1.0, PHP 5) — 获取关联数组的名字所有的常量和他们的价值

array get_defined_constants ([ bool $categorize = false ] )

<?php

echo

;

define("MY_CONSTANT", 1);

print_r(get_defined_constants(true));

?>

6. get_declared_classes(PHP 4, PHP 5) — 获取由已定义类的名字所组成的数组

array get_declared_classes ( void )

<?php

echo

;

//define classone

class classone { }

//define classtwo

class classtwo { }

//This will show X classes (built-ins, extensions etc) with

//classone and classtwo as the last two elements

print_r(get_declared_classes());

//define classthree

class classthree { }

//...and four

class classfour { }

//Shows the same result as before with class three and four appended

print_r(get_declared_classes());

?>

如果觉得《PHP输出当前进程所有变量/常量/模块/函数/类的示例【PHP】》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。