0
我想在php..i中使用javascript varible我提到很多stackoverflow link
和google
但我沒有得到正確的解決方案..我也知道js是客戶端腳本語言,php是serverside..but我想在PHP JS varible,我還與ajax call
嘗試,但我想設置時區在這個文件中沒有其他的文件,所以Ajax調用是不是在我situation.any一個幫助工作我怎麼去same result for varible in echo and var_dump
...在php中使用Js變量
<html>
<script type='text/javascript'>
var timezone = jstz.determine();
var timezone=timezone.name();
console.log(timezone);
// it print 'Asia/Kolkata';
<?php $abc = "<script type='text/javascript'>document.write(timezone)</script>"?>
</script>
<?php
echo $abc;
// it print 'Asia/Kolkata';
var_dump($abc);
// it print string '<script type='text/javascript'>document.write(timezone)</script>' (length=65)
?>
</html>
任何幫助,必須appreciated..Thnks
單擊鼠標右鍵,查看源代碼,注重結果是什麼。 –
看這個問題/答案[http://stackoverflow.com/questions/1045845/how-to-call-a-javascript-function-from-php][1] [1]:HTTP ://stackoverflow.com/questions/1045845/how-to-call-a-javascript-function-from-php –
在我看來源亞洲/加爾各答回聲和var_dump打印
–