Kohana`index.php`方法链接和仆从?
在KohanaKohana`index.php`方法链接和仆从?,php,kohana,method-chaining,Php,Kohana,Method Chaining,在Kohanaindex.php文件中,有一个子句我有两个问题: if (PHP_SAPI == 'cli') // Try and load minion { class_exists('Minion_Task') OR die('Please enable the Minion module for CLI support.'); set_exception_handler(array('Minion_Exception', 'handler')); Minion_Task::factor
index.php
文件中,有一个子句我有两个问题:
if (PHP_SAPI == 'cli') // Try and load minion
{
class_exists('Minion_Task') OR die('Please enable the Minion module for CLI support.');
set_exception_handler(array('Minion_Exception', 'handler'));
Minion_Task::factory(Minion_CLI::options())->execute();
}
else
{
/**
* Execute the main request. A source of the URI can be passed, eg: $_SERVER['PATH_INFO'].
* If no source is specified, the URI will be automatically detected.
*/
echo Request::factory(TRUE, array(), FALSE)
->execute()
->send_headers(TRUE)
->body();
}
1) 什么是仆从
?
2) 以下是什么意思
->foo()
->bar()
->...etx
这只是方法链接吗?1)在代码的第一部分,Kohana正在检查脚本是否从命令行(CLI)运行。如果是这样,它会尝试使用仆从执行任务
Minion是通过CLI运行任务的框架
见:
以及:
2) 是的,这就是你在代码第二部分看到的方法链接。它可以很容易地重写为:
$request = Request::factory(TRUE, array(), FALSE);
$response = $request->execute();
$response->send_headers(TRUE);
echo $response->body();
1) 在该代码的第一部分中,Kohana正在检查脚本是否从命令行(CLI)运行。如果是这样,它会尝试使用仆从执行任务
Minion是通过CLI运行任务的框架
见:
以及:
2) 是的,这就是你在代码第二部分看到的方法链接。它可以很容易地重写为:
$request = Request::factory(TRUE, array(), FALSE);
$response = $request->execute();
$response->send_headers(TRUE);
echo $response->body();
1.仆从是一个忠诚于为主人服务的追随者!2.这些是对象(可能是类)中的函数。仆从是一个忠诚于为主人服务的追随者!2.这些是对象(可能是类)中的函数。请注意,
Request::execute
返回Response
object()。因此,最好修改代码,如:$response=$request->execute()$响应->发送_头(真)代码>请注意,Request::execute
返回Response
object()。因此,最好修改代码,如:$response=$request->execute()$响应->发送_头(真)代码>