laravel5.3です。
コントローラーから変数の配列の中身をviewへ渡して表示させたいのですが、Undefined variable: first (View: というエラーが出ていて表示されません。
ケアレスミスだと思うのですが、どこが間違えているでしょうか?
よろしくお願いします。
lang
1<!DOCTYPE html> 2<html> 3 <head> 4<meta charset="UTF-8"> 5 </head> 6 7 <body> 8 {{$first}} 9 10 11 12 <label>検索クエリ</label> 13 <form action="" method="post"> 14 <input type="text" name="user_name"> 15 <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>"> 16 <input type="submit"> 17 </form> 18 19 <TABLE> 20<TR> 21< 22</TR> 23<TR> 24<TD> 25 <li>}</li> 26 27 28</TD> 29<TD>改良の検索結果が入る<?php//{{$content}}?></TD> 30</TR> 31<TR> 32</TABLE> 33</body> 34</html> 35 36
lang
1<?php 2<?php 3 4namespace App\Http\Controllers; 5 6use Illuminate\Http\Request; 7use Auth; 8use App\Http\Requests; 9use Search; 10 11class SearchController extends Controller 12{ 13 public function index(Request $request) 14 { //$name = Input::get('search'); 15 //var_dump($name); 16 //$before = Search::dataSearch(); 17 18 $data = []; 19$data['first'] = 'Taro'; 20$data['last'] = 'Yamada'; 21 //var_dump($content);exit; 22 //var_dump($before);exit; 23 return view('sample', $data); 24 25 //echo 'helloaaaa';exit; 26 } 27} 28 29```lang-php
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/09/23 09:13