为了账号安全,请及时绑定邮箱和手机立即绑定

在 php 文件中添加一个 Php 文件

在 php 文件中添加一个 Php 文件

PHP
翻过高山走不出你 2021-06-17 14:09:15
我正在尝试在 php 文件中添加一个 php 文件,但它不起作用..<?phpecho '<p><a href="/Confusing_English/A_Lot_Of_Many.html"><strong> A Lot Of & Many </strong></a></p><p><a href="/Confusing_English/Already.html"><strong> Already </strong></a></p> <?php include 'Include/adsense.php'; ?>      ';?>
查看完整描述

3 回答

?
暮色呼如

TA贡献1853条经验 获得超9个赞

您已经在字符串引号 ( 'not executable string') 中编写了所有内容,因此解释器将其读取为字符串,而不是可执行代码。


也不需要echo使用 PHP来处理纯 HTML。


请按以下步骤操作:


<p><a href="/Confusing_English/A_Lot_Of_Many.html"><strong> A Lot Of & Many </strong></a></p>    

<p><a href="/Confusing_English/Already.html"><strong> Already </strong></a></p>    


<?php include 'Include/adsense.php'; ?> 

解释


有一个小代码示例:


<?php // start tag


echo 'This is not executable'; // it will just show on your screen "This is not executable"


include 'Include/adsense.php'; // let's consider is as command, PHP parser will read it as a single command, in this case it tells to include given file


echo 'Not executable either'; // part inside quotes is not executable, so it will output on the screen "Not executable either"


?> // end tag

我认为您应该阅读一些有关 PHP 基础知识的文章。下面的链接(w3schools 在某些情况下不是很好,但对于基础知识,我认为它很好)。


查看完整回答
反对 回复 2021-06-25
?
蓝山帝景

TA贡献1843条经验 获得超7个赞

您正在<?php输入一个已经从 PHP 输出的字符串,


只需将您的代码更改为


<?php

   echo '

   <p><a href="/Confusing_English/A_Lot_Of_Many.html"><strong> A Lot Of & Many </strong></a></p>


   <p><a href="/Confusing_English/Already.html"><strong> Already </strong></a></p>

   ';


    include 'Include/adsense.php';

?>


查看完整回答
反对 回复 2021-06-25
?
杨魅力

TA贡献1811条经验 获得超6个赞

试试这个:


<?php


echo '<p><a href="/Confusing_English/A_Lot_Of_Many.html"><strong> A Lot Of & Many </strong></a></p><p><a href="/Confusing_English/Already.html"><strong> Already </strong></a></p>';

include 'Include/adsense.php';


?>


查看完整回答
反对 回复 2021-06-25
  • 3 回答
  • 0 关注
  • 177 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信