我如何在PHP中创建用户定义的函数?

时间:2022-11-30 15:34:52

How can I create a function as cms_database_select() which works as mysql_select_db() ?

如何创建一个函数cms_database_select()作为mysql_select_db()?

3 个解决方案

#1


0  

Pass in the parameters as required in protocol.

传递协议中要求的参数。

function cms_database_select(){
    mysql_select_db();
}

#2


0  

function cms_select_db($dbname, $link) {
    return mysql_select_db($dbname, $link);
}


Why?

#3


0  

More if you like ..

更多如果你喜欢..

function cms_database_select(){
   return call_user_func_array("mysql_select_db", func_get_args());
}

#1


0  

Pass in the parameters as required in protocol.

传递协议中要求的参数。

function cms_database_select(){
    mysql_select_db();
}

#2


0  

function cms_select_db($dbname, $link) {
    return mysql_select_db($dbname, $link);
}


Why?

#3


0  

More if you like ..

更多如果你喜欢..

function cms_database_select(){
   return call_user_func_array("mysql_select_db", func_get_args());
}