0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Laravel】Blade

Posted at

Blade

テンプレートエンジン

↓保存先
image.png

Bladeディレクティブ

@if ~ @endif という方法書く構文

image.png

{{}}エコー文
 XSS攻撃を防ぐために、PHPもhtmlspecialchars関数を投資手自動的に送信。

XSS攻撃(クロスサイトスクリプティング)→Webサイトの脆弱性を利用し、HTMLに悪質なスクリプトを埋め込む攻撃。サイトに設置されたフォームに悪質なHTMLスクリプトを埋め込みが実行。入力された情報に加えCookie情報も取られてしまう。

CSREフィールド

CSRF保護
@csrf Bladeディレクてぃぶを使用してトークンフィールドを生成。ミドルウェアがリクエストをバリデーションできるように、フォームに隠しCSRFトークンフィールドを含める。

※POST通信時は必ず書かないとエラーがでる

<form method="POST" action="/profile">
    @csrf

    ...
</form>

追記

Laravel7~ コンポーネントが追加
Livewire PHPで動的に書ける
Inertial(Vue.js/React)

0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?