标签:routing dir obs cti com fun ade nat 调用
1.在路由处设置参数name
Route::get(‘/index/{name}‘,‘Controller@index‘);
2.接收name参数,使用view调用显示html页面
<?php namespace App\Http\Controllers; use http\Env\Request; use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Routing\Controller as BaseController; use Illuminate\Routing\Route; use Illuminate\Support\Facades\Redirect; class Controller extends BaseController { use AuthorizesRequests, DispatchesJobs, ValidatesRequests; public function index($name){ return view(‘welcome‘,[‘name‘=>$name]); } }
3.在resources/views文件夹中创建xxx.blade.php文件,使用{{$xx}}调用变量即可,与TP5类型。
标签:routing dir obs cti com fun ade nat 调用
原文地址:https://www.cnblogs.com/jichenghui/p/13195088.html