添加註意事項 我必須在靜態網頁的html正文中粘貼3次以下代碼,而不必粘貼它並有很多代碼,我寧願只有一個代碼線(3次)調用的代碼寫的,就像這樣:<?php getgooglepub(); ?>
輸出代碼AS IS
我喜歡做一個PHP函數,將輸出中的HMTL頁面的谷歌analitic代碼或AdSense ....趁熱格式代碼輸出「原樣」與所有<>「」'''
這裏是示例鱈魚E要輸出:
<script type="text/javascript"><!--
google_ad_client = "pub-0743213818925076";
/* 728x90, date de création 11/02/10 */
google_ad_slot = "9774402576";
google_ad_width = 870;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
注意,儘管創意的答案,我發現現在myselft能夠beeing使它工作......可以肯定,我的fautl ....我會複製粘貼代碼,可以肯定,你會標誌的問題,因爲我不知道!..
function getgooglepub()
{$google_code = <<<EOT
<script type="text/javascript"><!--
google_ad_client = "pub-0743213818925076";
/* 728x90, date de création 11/02/10 */
google_ad_slot = "9774402576";
google_ad_width = 870;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
EOT;
echo htmlspecialchars($google_code);}
後,在HTML代碼中有電話
<?php getgooglepub(); ?>
這是從頁面的源代碼在Firefox渲染... abviousely不工作
<script type="text/javascript"><!--
google_ad_client = "pub-0743213818925076";
/* 728x90, date de création 11/02/10 */
google_ad_slot = "9774402576";
google_ad_width = 870;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
我對[數據]標籤讀取的地方?....這也許辦法去做 ?
如果要按原樣顯示html,那麼這就是頁面源_應該看起來像什麼。 – GZipp 2010-02-12 13:16:09