JavaScript在URL中获得PHP变量
问题描述:
你好吗? 我需要一些帮助的JavaScriptJavaScript在URL中获得PHP变量
我有WHMCS(http://docs.whmcs.com/Data_Feeds)的这段代码: {文字} {/文字}
{文字} =>运行JavaScript在WHMCS Templetes文件 {/文字} = >完成JavaScript
我需要更改值& currency = 1与我的URL中的变量。
例如index.php的货币= 4有这样的代码:{文字} {/文字}
你能帮助我吗?
问候,亚历克斯:)
答
像这样的东西应该这样做:
<?php
$currency = 1;
if (isset($_REQUEST['currency']) && is_numeric($_REQUEST['currency'])) {
$currency = intval($_REQUEST['currency']);
}
?>
<script language="javascript" src="feeds/productsinfo.php?pid=41&get=price&billingcycle=annually¤cy=<?= $currency ?>"></script>
感谢肖恩! :) – 2013-03-06 03:38:37