小白教程
所有教程
关于
Search
172.70.178.62
172.70.178.62
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Php var export function”的源代码
本页内容
上一节:
Php_var_dump_function
下一节:
Php_password_get_info
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:var_export}}[[Category:php variable handling functions|35]] = PHP var_export() 函数 = [[php variable handling functions|PHP 可用的函数]] '''var_export()''' 函数用于输出或返回一个变量,以字符串形式表示。 '''var_export()''' 函数返回关于传递给该函数的变量的结构信息,它和 [[php var_dump function|var_dump()]] 类似,不同的是其返回的是一个合法的 PHP 代码。 PHP 版本要求: PHP 4 >= 4.2.0, PHP 5, PHP 7 === 语法 === <sample title="" desc="" lang="php" hererun="1"> mixed var_export ( mixed $expression [, bool $return ] ) </sample> 参数说明: * $expression: 你要输出的变量。 * $return: 可选,如果设置为 TRUE,该函数不会执行输出结果,而且将输出结果返回给一个变量。 === 返回值 === $return 设置为 true 时才有返回值,返回变量的结构信息。 == <sample title="" desc="" lang="php" hererun="1"> <?php $a = array (1, 2, array ("a", "b", "c")); var_export ($a); ?> </sample> 输出结果为: <sample title="" desc="" lang="php" hererun="1"> array ( 0 => 1, 1 => 2, 2 => array ( 0 => 'a', 1 => 'b', 2 => 'c', ), ) </sample> 可选参数 $return 设置为 true: <sample title="" desc="" lang="php" hererun="1"> <?php $b = 3.1; $v = var_export($b, TRUE); echo $v; ?> </sample> 输出结果为: <sample title="" desc="" lang="php" hererun="1"> 3.1 </sample> [[php variable handling functions|PHP 可用的函数]]
返回至“
Php var export function
”。
上一节:
Php_var_dump_function
下一节:
Php_password_get_info