前提・実現したいこと
エラーを修正してブラウザを表示して、複数アクションの利用をしたいです。
発生している問題・エラーメッセージ
Parse error: syntax error, unexpected end of file
該当のソースコード
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; class HelloController extends Controller { public function index($id='noname', $pass='unknown') { return <<<EOF global $head, $style, $body, $end; $head = '<html><head>'; $style = <<<EOF <style> body {font-size:16; color:#999; } h1 { font-size:100pt; text-align:right; color:#eee; margin:-40px 0px -50px 0px; } </style> EOF; $body = '</head><body>'; $end = '</body></head>'; function tag($tag, $txt) { return "<{$tag}>" . $txt . "</{$tag}>"; } class HelloController extends Controller { public function index() { global $head, $style, $body, $end; $html = $head . tag('title','Hello/Index') . $style . $body . tag('h1','Index') . tag('p','this is index page') . '<a href="/hello/other">go to Other page</a>' . $end; return $html; } public function other() { global $head, $style, $body, $end; $html = $head . tag('title','Hello/Other') . $style . $body . tag('h1','Other') . tag('p','this is Other page') . $end; return $html; } }
該当のソースコード
Route::get('hello', 'HelloController@index'); Route::get('hello/other', 'HelloController@other');
試したこと
該当ソースコード(上)のコードでコントローラーの記述をしたのちに該当ソースコード(下)のルーティングを用意しました。
しかし、コードによるエラー表記ができてしまいます。
Parse error: syntax error, unexpected end of file
上記のようなエラー表記がでてしまったのでコードの見直しをしましたが、打ち間違いなどは見られませんでした。
どのような理由でエラーになっているのでしょうか?