Deprecated: Optional parameter $keys declared before required parameter $cms_id is implicitly treated as a required parameter in /home/www/dev/work/class/blog/CmsKey.php on line 75

Deprecated: Creation of dynamic property lvesu\lvesu\controller\blog\main::$outlink is deprecated in /home/www/dev/work/website/lvesu/template/blog/cms/cms.tpl on line 2

Deprecated: Creation of dynamic property lvesu\lvesu\controller\blog\main::$status is deprecated in /home/www/dev/work/website/lvesu/template/blog/index.head.php on line 2
Laravel给request变量赋值,追加参数,修改参数 - 互联网笔记

略微加速

略速 - 互联网笔记

Laravel给request变量赋值,追加参数,修改参数

2022-11-08 leiting (2879阅读)

标签 PHP

一、修改request

$request->merge(['ver' => 'V1']);

二、添加

//添加一个request字段,customer_id
request()->offsetSet('customer_id', $customer->id);
dd(request(customer_id));
//或者
if(!$request->state){
    request()->offsetSet('state', '0');
}


北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3