我想在我的HTML页脚中插入一个PHP回显。
它适用于我的 header.inc.php 。示例:
<link href="<?php echo $style; ?>" rel="stylesheet" type="text/css">
在我的 footer.inc.php 中,我想改变一下:
<script src="js/jquery-1.11.0.min.js" type="text/javascript"></script>
到:
<script src="<?php echo $jquery; ?>" type="text/javascript"></script>
但我的编辑(Coda)强调语法无效:
答案 0 :(得分:1)
如果定义了php变量,可以使用:
<link href="<?=$style?>" rel="stylesheet" type="text/css">
和
<script src="<?=$jquery?>" type="text/javascript"></script>
答案 1 :(得分:-2)
这应该有效:
<?php include "myscripts.php";?>
我的scripts.php看起来像:
<script>
.................................
</script>
在你所做的具体声明中:
<?php echo "<script src='" . $jquery . "' type='text/javascript'></script>"; //no closing to continue the php coding
注意我的引用更改,并在PHP页面上进行。