gpt4 book ai didi

Laravel 在 Controller 外部获取 Route 参数

转载 作者:行者123 更新时间:2023-12-02 10:10:00 24 4
gpt4 key购买 nike

我定义了一个像这样的虚拟路线:

Route::get('sth/{v1}/{v2}' , [
'uses'=>'SthController@sth',
]) ;

如何获取外部 Controller v1v2的值?

最佳答案

使用此代码

$current_params = Route::current()->parameters();

dd($current_params->v1) ;

关于Laravel 在 Controller 外部获取 Route 参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37910517/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com