我想你应该更确切地说明什么样的功能。 Wordpress不提供类似的东西,大多数PHP应用程序不会。
我也认为你在这里呼唤麻烦,因为这种应用程序在这种环境下没有开发出来。
下面是一个试图从函数中调用“current_time()”的示例。PHP和尝试我不得不这样做只是为了实现它不会工作方式:
php -r 'require "functions.php"; var_dump(current_time("mysql"));'
给
Fatal error: Call to undefined function apply_filters() in functions.php on line 346
试图
php -r 'require "functions.php"; require "plugin.php"; var_dump(current_time("mysql"));'
给
Fatal error: Call to undefined function wp_cache_get() in functions.php on line 351
尝试
php -r 'require "functions.php"; require "plugin.php"; require "cache.php"; var_dump(current_time("mysql"));'
给
Fatal error: Call to a member function get() on a non-object in cache.php on line 93
望着源中的最后一个错误我看到
function wp_cache_get($id, $flag = '') {
global $wp_object_cache;
return $wp_object_cache->get($id, $flag);
}
使用全局变量使得测试在其它环境皮塔如果不是不可能的。
如果这不是你想要做的,你必须在你的问题中更具体/详细。
我看过你的问题和你的后续解释,但仍然没有完全理解你想达到的目标。你想执行shell PHP来验证wordpress函数返回正确的值吗? – mark 2008-12-30 10:53:27