从其他调用一个PHP函数?
答
做到这样,
文件中,你需要调用的函数
require_once("file_having_function_that_you_need_to_call.php");
function_name($arguments); // this function is defined in 'file_having_function_that_you_need_to_call.php' file
答
首先,你需要包含这个文件或者使用
require_once or require
或
include_once or include
如果功能不上课,你会直接调用。
require("file.php");
echo getUserName("1")
否则,你必须首先创建对象,比调用方法
require("file.php");
$obj = new User();
echo $obj->getUserName("1");
已经回答了无数时间:http://stackoverflow.com/search?q=calling+one+php+function+from+other和http://stackoverflow.com/search?q=include+files+php - 另外,请接受一些你回答15个问题滑到目前为止。 – Gordon 2010-02-19 10:47:01