例如:
複製代碼 代碼如下:
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不存在.
http://www.bkjia.com/PHPjc/322977.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/322977.htmlTechArticle例如: 複製代碼 代碼如下: function say () { alert (arguments[0]+'說:'+arguments[1]); } say ('fanglor','fanglor is a boy !'); 結果:彈出 fanglor 說:fanglor is a boy...