English 中文(简体)
简明灯 重复守则
原标题:Simple PHP echo code not working
  • 时间:2011-10-03 18:48:53
  •  标签:
  • php
  • echo

这里是我的html,有一套文件:

  <html>
      <head>
    <title>Bob s Auto Parts</title>
  </head>
  <body>
    <h1>Bob s Auto Parts</h1>
     <table width = 100% >
         <tr>
             <?php
                 echo "<td>This is working.</td>";
             ?>
         </tr>
     </table>
  </body>
 </html>

为什么这种产出出现于一、二、三、四、五、五、五、五、五、五、四、五、五、四、五、四、五、五、四、五、四、五、四、五、五、四、五、五、四、五、八、五、八、九、八、八、九、八、九、八、九、八、九、八、九、八、九、八、八、八、九、八、八、八、九、八、八、九、八、九、八、九、九、八、九、八、八、九、九、八、八、八、九、八、九、九、八、九、九、九、八、九、九、八、八、八、九、九、八、八、八、八、八、九、九、九、九、九、八、九、九、九、九、八、九、九、九、八、八、八、八、八、八、八、八、八、九、九、九、八、八、八、八、九、八、 仅限。 这里是名声。

Bob s Auto Parts

Bob s Auto Parts

This is working."; ?>

我知道,我在这里做了一些错误的事情,但无法说出。 提前感谢。

最佳回答

Any of these (or more) could be your answer why it is not working

  1. Is there actually PHP running on your computer?
  2. Is the file extension .php?
  3. Are you accesing the file through your browser doing something like http://localhost/myfile.php
  4. If it is on a remote server, is there PHP installed?
问题回答

Make sure that you are using <?php and not <? shorthand since that may be disabled on your server. This will cause the output of "; ?> as it happened to me a few months ago in a transition to PHP5.

我只看到了奇量产出,而PHP的底线是把它作为PHP探测到的。 确保对项目设计书按预期运行,并认识到<代码><?php标签。

In my case (which is a very specific case) installing this missing package (Ubuntu 14.04) did the trick:

sudo apt-get install libapache2-mod-php5

a. 安装包裹的用户:

sudo apt-get install libapache2-mod-php7.0

之后,刚刚重新开始:

sudo service apache2 restart

你们走了。

我在宣读我的错误时也存在同样的问题:

http:// localhost/test.php 我在文件file http:///C:/Users/.../htdocs/test.php>上被双重点击。

档案在UniCode Encoding中保存。 打开了“灯塔”的档案,通过将“ANSI”改为“ANSI”予以保存,并将档案作为档案Name.php和“所有档案”类型予以保存。

Make sure the extension is .php and check echo tags on phpmanual. php.net/manual/en/function.echo.php

当你试图将html标记纳入对应职能时,你需要在“或”之间插入“或使用”。

为了显示PHP,或操作嵌入的PHP,你需要告诉PHP,看上去HTM &超文本文档。

需在称为<代码>的超文本目录的正文中存档,该目录是一份简单的文本文件,其行文如下:

<编码># 类型应用/x-httpd-php .html

This lets the PHP compiler know to compile the php when displaying the HTML page.

http://localhost/demo/demo.html will not work. http://localhost/demo/demo.php will work. php work on .php extension. Good Luck bro

如果你安装了超过2版本的购买力平价,则进行检查。 服务器可能会在一段时间内混淆不清。 首先是综合处理文件系统版本,只重印一个PHP版本。





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...