Php 拉威尔杆
我想执行一个post方法,但这似乎不起作用 现在我有了URLPhp 拉威尔杆,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
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
}