我的文本區域字段是這樣的:<textarea type="text" id="tos"><?php echo $tos; ?></textarea> 輸出是:Terms of Service of 'Website Name'1. Term one2. Term two3. Term three4. Term four5. Term five如何作為'Website Name'php echo 從包含的文件或數據庫表中獲取站點名稱,而不是手動輸入?文件中的 var 是$site.我無法在文本框中使用 php 標簽,那么如何使用{site}或從包含文件中的{sitename}var 獲取值?$site
1 回答

繁華開滿天機
TA貢獻1816條經驗 獲得超4個贊
您可以使用此功能str_replace($search, $replace, $subject)
將“網站名稱”占位符替換為網站的實際名稱。
像這樣:
<textarea type="text" id="tos"><?php $tos = str_replace("Website Name", $site, $tos); echo $tos; ?></textarea>
- 1 回答
- 0 關注
- 129 瀏覽
添加回答
舉報
0/150
提交
取消