php 系統模版 原生PHP模板系統 Plates

2021-10-22 22:46:32 字數 943 閱讀 9572

plates 是原生 php 模板系統,非常容易使用和擴充套件,靈感**於 twig 模板引擎,包括現代化的模板語言功能。plates 主要是為在編譯模板語言中選擇使用原生 php 模板的開發者提供的。

here is a ****** example of how to use plates. we will assume the following directory stucture: `-- path `-- to `-- templates |-- template.php |-- profile.php

within your controller // create new plates instance$templates = new league\plates\engine('/path/to/templates');// render a templateecho $templates->render('profile', ['name' => 'jonathan']);

the page template

profile.php layout('template', ['title' => 'user profile']) ?>

user profile

hello, =$this->e($name)?>

the layout template

template.php =$this->e($title)?>=$this->section('content')?>

值得關注的特性 原生 php 模板,不需要學習新的語法

plates 是模板系統,不是模板語言

plates 鼓勵使用現有的 php 函式

使用模板布局和繼承提公升**復用性

跨模板資料共享

內建轉義幫助函式

無固定框架,可以運用在任意的專案中

解耦設計,容易測試

支援 composer,相容 psr-2

專案主頁:

PHP原生模板引擎 最簡單的模板引擎

複製 如下 php a array a b c require template demo.php 引用模板 程式設計客棧 模板檔案 複製代gkugmrgq碼 如下 程式設計客棧ype html 模板測試 a 程式設計客棧1 複製 如下 陣列的迭代 smarty 鍵值 對於php程式設計師那個更好理...

php崗位招聘模版

工作內容 1 負責xx網的規劃 系統構架 研發 維護和審查監督 2 負責相關組織 部門之間工作的協調 3 攻關研發過程中疑難問題 4 負責mysql資料庫應用,sql語句優化 5 負責 分布式系統架構和伺服器集群設定 6 負責 安全,伺服器安全 保證 的正常運營 職位要求 1 5年以上大規模網際網路...

php 資料 模板,php模板總結

模板這東西,其實最重要的是適合自己的專案需求,而不是適合自己的習慣.比如乙個企業的宣傳 訪問量不大,更新量也不大,用什麼都一樣,甚至不用,直接php html寫可能速度最快.也沒什麼不可.但是如果是乙個新聞系統,或者是內容發布系統.兩者這樣,就非常有必要用到模板這一技術.因為他們都 有乙個共通的地方...