LoginSignup
4
0

More than 5 years have passed since last update.

ヒアドキュメント

Posted at

ヒアドキュメントとは

ヒアドキュメントというのは、PHPで長文テキストを記述するのに使われるもの。

<<<演算子を使い、リスト内に記述されたテキストをまとめて変数などに代入することができる。

例.
$html = <<<EOF
<html>
<head>
<title>Hello</title>
<style>
body {font-size:16px; color:#999;}
h1 {font-size:100px; text-align:right; color:#eee; margin:-40px 0px -50px 0px; }
</style>
</head>
<body>
 <h1>Hello</h1>
 <p>This is sample page.</p>
</body>
</html>
EOF;

Route::get('hello',function () use ($html){
  return $html;
});

スクリーンショット 2018-12-03 20.04.29.png

こんな感じで使うことができる!!

ちなみにドキュメントとは資料のことらしい!!笑笑

こちらを参照にしました。


また、この記事はPHPフレームワークLaravel入門のアウトプットとして書いてみました。

自分がまだ理解していない部分を文字で起こすことによって頭の中を整理することが目的です。

てゆうかルーティング設定しなくてもそのままウェブに返すことできるんだね!!

4
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
0