我想在OpenCart中的.tpl文件中获取当前的url.
我已经看到了这个答案,但它只适用于php文件.
我必须这样:
_my_array.push(['_productName',"<?php echo $heading_title; ?>"]);
**_my_array.push(['_productUrl', ["how can I get url ?"]]);**
Run Code Online (Sandbox Code Playgroud)
谢谢
要获得完整的网址
<?php
$url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
?>
Run Code Online (Sandbox Code Playgroud)
顺便说一句,这些答案也适用于tpl文件,因为tpl文件只是一种php文件