Home >Backend Development >PHP Tutorial >PHP+Javascript javascript,php code to obtain function parameter object

PHP+Javascript javascript,php code to obtain function parameter object

PHP中文网
PHP中文网Original
2016-07-29 08:44:21947browse

For example:

Copy code The code is as follows:


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


Result: pop up fanglor said: fanglor is a boy !
-------------------------- -------------------------------------------------- ----
This is somewhat similar to the func_get_args() function in PHP, which also obtains an array of function parameters.
Example (the following is the php code):

Copy code The code is as follows:


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 does not exist! ";
}
}
}
}
}
//Encapsulate include again
uses ('config','db');


Automatically load config.php and db .php, if it does not exist, it will display that {__file__}.php does not exist.

The above introduces PHP+Javascript javascript, PHP code for obtaining function parameter objects, including PHP+Javascript content, I hope you are interested in PHP tutorials Friends help.

Statement:
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