Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/233.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 拉威尔杆_Php_Post_Laravel 4_Slug - Fatal编程技术网

Php 拉威尔杆

Php 拉威尔杆,php,post,laravel-4,slug,Php,Post,Laravel 4,Slug,我想执行一个post方法,但这似乎不起作用 现在我有了URLlocalhost/newthread/5 那很好,但是现在我想让5(slug)可以发布 我该怎么做 视图: 路线: Route::group(array('before' => 'auth'), function() { Route::get('/newthread/{cid}', array('uses' => 'ForumController@CreateTopic', 'as' => 'Nieuw to

我想执行一个post方法,但这似乎不起作用

现在我有了URL
localhost/newthread/5

那很好,但是现在我想让
5
(slug)可以发布

我该怎么做

视图:

路线:

Route::group(array('before' => 'auth'), function()
{
    Route::get('/newthread/{cid}', array('uses' => 'ForumController@CreateTopic', 'as' => 'Nieuw topic'));
});
Route::post('/PostTopic', array('uses' => 'ForumController@PostTopic', 'as' => 'Post_topic'));

奇怪的是,隐藏的输入是我做不到的。因为在我看来,这只是一种观点。如何修复此问题?

尝试使用post{cid}作为查询参数

public function CreateTopic($cid)
    {
        $data['cid']=$cid;
        return View::make('sayfa.createtopic',$data);
    }
部分意见:

{{ Form::open(array('url' => 'PostTopic/'.$cid)) }}
                <div class="form-group">
                    <label>Topic Naam (onderwerp):</label>
                    <input type="text" class="form-control" name="title">
                </div>

                <label>Bericht:</label>
                <textarea name="message" class="form-control" rows="5" placeholder="Typ uw bericht..."></textarea>

                <br>
                <button type="submit" class="btn btn-success">Nieuw topic plaatsen</button>

                {{ Form::close() }}
张贴方法:

public function PostTopic($cid){
       //you can now have $cid with other inputs
    }

你想提交到/postTopic还是/sumbitnewtopics对不起,输入错误,它是到/postTopic.Works就像一个符咒!谢谢
{{ Form::open(array('url' => 'PostTopic/'.$cid)) }}
                <div class="form-group">
                    <label>Topic Naam (onderwerp):</label>
                    <input type="text" class="form-control" name="title">
                </div>

                <label>Bericht:</label>
                <textarea name="message" class="form-control" rows="5" placeholder="Typ uw bericht..."></textarea>

                <br>
                <button type="submit" class="btn btn-success">Nieuw topic plaatsen</button>

                {{ Form::close() }}
Route::post('/PostTopic/{cid}', array('uses' => 'SOController@PostTopic', 'as' => 'Post_topic'));
public function PostTopic($cid){
       //you can now have $cid with other inputs
    }