Home > php教程 > php手册 > javascript,php获取函数参数对象的代码

javascript,php获取函数参数对象的代码

WBOY
Release: 2016-06-06 20:36:05
Original
956 people have browsed it

javascript,php获取函数参数对象的代码,需要的朋友可以参考下。

例如:

复制代码 代码如下:


function say () {
alert (arguments[0]+'说:'+arguments[1]);
}
say ('fanglor','fanglor is a boy !');


结果:弹出 fanglor 说:fanglor is a boy !
--------------------------------------------------------------------------------
这个有点类似于php 中的 func_get_args() 函数,也是获取函数参数的数组。
例(以下是php代码):

复制代码 代码如下:


function uses () {
$args =func_get_args();
if (!empty($args)) {
foreach ($args as $key => $val ) {
if (file_exists($val.'.php')) {
include "{$val}.php";
} else {
if (DEBUG) {
echo "{$val}.php 不存在!";
}
}
}
}
}
//再次封装 include
uses ('config','db');


自动装载 config.php 和 db.php ,如不存在,显示 {__file__}.php不存在.
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template