Laravel 4 使用IOC容器外的路由器Laravel
我有一个接口Laravel 4 使用IOC容器外的路由器Laravel,laravel-4,Laravel 4,我有一个接口 <?php namespace Acme\Billing; use Stripe; class StripeBilling implements BillingInterface { } 您可以使用 $redirector = \App::make('redirect'); return $redirector->to('url'); 或者直接使用它,就像: return \App::make('redirect')->to('url');
<?php namespace Acme\Billing;
use Stripe;
class StripeBilling implements BillingInterface {
}
您可以使用
$redirector = \App::make('redirect');
return $redirector->to('url');
或者直接使用它,就像:
return \App::make('redirect')->to('url');
或者您想要的任何方法,但refresh()
方法可能会在同一页面中产生重定向循环,因此请小心
更新:还请记住,如果使用使用SomeNameSpace\XXX,则在使用另一个命名空间的另一个类时,请使用前面的\
,即\Acme\Billing\Redirect
没有\
来自Acme\Billing
那么composer会认为它是Acme\Billing\SomeNameSpace\XXX
我可以在接口内使用它,因为它在IoC容器外