我試圖在PHP if語句中回顯出Google AdWords轉換跟蹤代碼的Javascript。我做了一堆Google搜索,但似乎無法找到我需要轉義以確保代碼正確執行的字符的確切列表。任何人都有建議?在PHP中回顯Javascript時需要轉義哪些字符?
這個代碼第一位是調用與轉化代碼段的包括if語句的開始:
if (@mailit) {
include ("conversioncodes.php");
這是conversioncodes.php包含代碼的內容片斷,我是試圖找出如何正確逃避。目標是在滿足if語句的條件時讓轉換代碼跟蹤轉換。
echo "<!-- Google Code for Homepage Form Submit Conversion Page -->
<script type="text/javascript">
<!--
var google_conversion_id = XXXXXXXXXX;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "XXXXXXXXXXXXXXX";
var google_conversion_value = 0;
//-->
</script>
<script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="http://www.googleadservices.com/pagead/conversion/XXXXXXXXXX/?label=XXXXXXXXXXXXXXXXXXX&guid=ON&script=0"/>
</div>
</noscript>";