【发布时间】:2016-03-17 13:06:31
【问题描述】:
我刚开始使用laravel,想了解这个...
假设我们的应用程序中有一个类:
namespace App\Tests;
class MyTest{
public function sayHello($name){
echo "Hello, $name!";
}
public static function anotherTest(){
echo "another test...";
}
}
创建外观和服务提供者比仅仅使用它有什么优势
use App\Tests\MyTest;
//... controller declarations here ....
public function someaction(){
$mt = new MyTest();
$mt->sayHello('John');
//or
MyTest::anotherTest();
}
//... etc...
【问题讨论】:
标签: php laravel dependency-injection laravel-5 laravel-facade