laravel 实时facade
实时facade
-
创建一个目录叫services
http = $http; } public function publish($status){ $this->http->post($status); } }
创建一个weibo类
创建一个Http类
<?php
namespace App\Services;
class Http
{
public function __construct()
{
}
public function post($status){
return dd('I post a post'.$status);
}
}
路由修改
use Facades\App\Services\weibo;
//facade
Route::get('facade',function (){
weibo::publish('这是一条微博');
});
现在访问就有了:"I post a post这是一条微博"