最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

如何僅將特定的 div 元素包含到 php 中的頁面?

如何僅將特定的 div 元素包含到 php 中的頁面?

PHP
慕田峪9158850 2023-06-18 16:04:06
這可能嗎?我沒見過這種代碼。我真的很想實(shí)現(xiàn)這個(gè),但我無法搜索它,或者我不知道這種執(zhí)行是如何調(diào)用的。在 php 頁面上,我有 div 的這個(gè)元素。elements.php<div id="countries"><p>Malaysia</p><p>India</p></div><div id="cities"><h2>sihgn</h2><p>sighn city</p></div><div id="street"><h2>nowhere</h2><p>somewhere</p></div>在僅顯示特定 div 的 showcountryonly.php 上。<?php include (elements.php)?> ???? echo div #countries在僅顯示城市的 showcitiiesonly.php 上。<?php include (elements.php)?> ???? echo div #cities在僅顯示街道 div 的 showstreetonly.php 上。<?php include (elements.php)?> ???? echo div #street 我想實(shí)現(xiàn)這個(gè)的原因是我只想為我的所有包含編輯一個(gè)頁面。謝謝。
查看完整描述

1 回答

?
12345678_0001

TA貢獻(xiàn)1802條經(jīng)驗(yàn) 獲得超5個(gè)贊

您可以為每個(gè) div 定義一個(gè)變量elements.php:


$countries = '<div id="countries">

<p>Malaysia</p>

<p>India</p>

</div>';


$cities = '<div id="cities">

<h2>sihgn</h2>

<p>sighn city</p>

</div>';


$streets = '<div id="street">

<h2>nowhere</h2>

<p>somewhere</p>

</div>';

包含元素文件后,您可以只回顯所需的變量:


<?php

include (elements.php);

echo $countries; // $cities or $streets

?>

希望這可以幫助。


查看完整回答
反對(duì) 回復(fù) 2023-06-18
  • 1 回答
  • 0 關(guān)注
  • 132 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)