.php文件在Chrome中显示代码 [英] .php file shows code in Chrome

查看:439
本文介绍了.php文件在Chrome中显示代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个注册页面,我从下面找到网站。我下载了源代码并提取了文件,找到 login.php 。我在Adobe Dreamweaver CS3中打开它加载它并显示没有代码,但是当我单击Chrome中的预览时,Chrome会显示整个文件代码,如下所示。当我点击iExplore中的预览时,它也是如此。我做错了什么,或者我的笔记本电脑上没有东西吗?我没有把网页的其余代码放到网页上,因为我觉得这是irevelent,因为当我切出php代码并测试它的页面显示。就在我插入PHP代码的时候。 PHP是Dreamweaver放置在新的HTML或PHP文件的开头的普通代码。

I have a register page I retrieved off of the following site. I downloaded the source code and extracted the file, finding the login.php. I open it in Adobe Dreamweaver CS3 which loads it and shows no code, but when I click Preview in Chrome, Chrome shows the entire files code, which is shown below. When I click Preview in iExplore, it does the same. Am I doing something wrong or is there something I don't have on my laptop? I have not put the rest of the code for the webpage because I feel it is irevelent as when I cut the php code out and tested it it the page shows. It is just when I insert the PHP code. After the PHP is the normal code that Dreamweaver places in at the start of a new HTML or PHP file.

<?PHP
require_once("./include/membersite_config.php");

if(isset($_POST['submitted']))
{
   if($fgmembersite->Login())
   {
    $fgmembersite->RedirectToURL("login-home.php");
   }
}

   ?>


推荐答案

要在计算机上显示PHP,您需要本地PHP服务器设置。没有它,就没有PHP引擎可以解释和解析你的代码,使它进入HTML浏览器。

To display PHP on your computer you need to have a local PHP server set up. Without it there is no PHP engine that can interpret and parse your code to make it in to HTML for the browser.

如果你没有安装本地PHP服务器,那么您将需要通过FTP将您的文件上传到服务器,在这里安装PHP。

If you haven't got a PHP server installed locally, then you will need to upload your files to a server via FTP, where PHP is installed.

这篇关于.php文件在Chrome中显示代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆