【问题标题】:Laravel https route for formLaravel https 表单路由
【发布时间】:2014-03-11 11:19:00
【问题描述】:

有没有办法使用刀片语法通过 https 提交表单?

我有 {{Form::open(['route' => 'pages.store', 'class' => 'crud-form'])}} 但这使用 http://

【问题讨论】:

    标签: php https laravel


    【解决方案1】:

    尝试强制您的路线安全

    Route::post('page/store', array('https', 'as' => 'pages.store');

    【讨论】:

      【解决方案2】:

      更好的方法是保护路线本身而不是形式,也许是这样的

      Route::post('/pages', [
          'https' => true
          'as'    => 'pages.store'
          'uses'  => 'PagesController@store''
      ]);
      

      Route::group(['https'], function()
      {
          // ur routes
      });
      

      查看http://laravel.io/forum/12-26-2014-routing-with-httpshttps://github.com/laravel/framework/issues/578 了解更多信息。

      【讨论】:

        【解决方案3】:

        保护路线对我没有用。相反,我在boot() 方法中将以下内容添加到我的AppServiceProvider 中:

        // forces use of https instead of http
        
        URL::forceScheme('https');
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2017-05-25
          • 2013-03-04
          • 2017-08-21
          • 2020-01-11
          • 2019-09-10
          • 2015-01-07
          • 2019-03-01
          • 2015-03-05
          相关资源
          最近更新 更多