我已閱讀過關於它的文章,但所有解決方案都無法幫助我。 我已將此添加到我的.htaccess
文件中:如何在javascript文件中使用php
<FilesMatch "\.(js)$">AddHandlerapplication/x-httpd-php .js</FilesMatch>
。
這是我的javascript代碼:
$('#calendar').fullCalendar({
header: {
left: 'prev,next',
center: 'title',
right: 'today'
},
defaultDate: "<?php echo $current ?>",
editable: false,
但沒有隨後出現。如果有人知道解決方案,我會很感激。
@PatrickEvans [當有隻有一個行是不正確的代碼](http://php.net/manual/en/language.basic-syntax.instruction-separation.php) –
爲什麼你想在這裏使用PHP?只要去'defaultDate:new Date(),'。 – connexo
@PatrickEvans這不是我的整個實際的代碼,它只是它的一部分。 $ current是剛纔定義的。 –