php新手!为什么浏览器不显示php代码? 浏览器运行以后总是出现空白页,然后查看源文件就发现没有php部分的代码?代码是下载的源码,是不是配置有问题啊?PHP浏览器 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 之前调用 mysql_connect()函数时, 提示我 undefined function 然后我改了php.ini把mysql.dll和mysqli.dll打开了,还改了其他的配置 查看源文件是看不到php代码的,代码是不是没有页面输出,所以出现空白页呢 这是下的代码,我也不是很清楚,但是不是写了echo吗 将 <? 改为 <?php 再说,之后再看情况。 <?是短标记,需要在php.ini开启short_open_tag才能使用,建议不要使用短标记 汗——!以<?php开头,以?>结尾 php.ini 中 display_errors=On 重启服务器再运行看有不有错误信息。 那肯定是你if的条件是false,所以没显示啊 我在浏览器里输入的http://127.0.0.1/webshop/product_info.php 查看源文件就发现没有php部分的代码这是正确的,php 代码不会出现在浏览器中! <html><head> <meta http-equiv="Content-Type" content="text/html; charsetgb2312" /> <title>商品内容页</title> <link href="images/style.css" rel="Stylesheet" type="text/css" /></head><body style="margin:0px 0px 0px 0px; text-align:center"><table border="1" cellspacing="0" cellpadding="0" style="width:100%"><tr><td width="250px"><?php require ('sub_newslist1.php'); require ('sub_newslist2.php'); require ('sub_productlist3.php');?> </td><td valign="top" width="750px"><table border="1" cellspacing="0" cellpadding="0" width="100%"> <?php require_once("conn/Conn_DB.php"); //包含数据库链接文件 if($_GET["P_ID"]!="") { $pid = $_GET["P_ID"]; //商品编号 $str = "select * from Product_Info where P_ID =".$pid; //查询语句 $arr = mysql_query( $str); //执行SQL语句 $result = mysql_fetch_array($arr); //获取查询结果?></table><table border="1" cellspacing="0" cellpadding="0" width="100%"> <tr><td rowspan="4" width="300px"><img src='<?php echo $result["P_Image"];?>' width="250px" height="250px"/> </td> <td width="450px"> <?php echo $result["P_Name"];?> </td></tr> <tr><td> 市场价: <?php echo $result["P_MPrice"];?> 会员价: <?php echo $result["P_VPrice"];?> </td></tr> <tr> <td> <?php echo $result["P_CreateTime"];?> </td></tr> <tr> <td><a class="a1" href="shopcar_info.php?P_ID=<?php echo $result["P_ID"];?>">放入购物车</a></td></tr> <tr><td colspan="2">商品详细介绍</td></tr> <tr><td colspan="2"> <?php echo $result["P_Intro"];?> </td></tr> <tr><td colspan="2"> <a class="a1" href="javascript:history.back(-1);" target="_self">返回</a> </td></tr> <?php } ?> </table></td></tr></table></body> </html> 本帖最后由 xuzuning 于 2013-06-16 13:51:29 编辑 为什么要这样写?显示404 Not Found file_get_contents的内存问题 〖Orz〗求1条sql语句 请问如何获取这个host?用php 各位大虾好!!如何防止网站里的数据文件被别人下载 access is denied 怎么查找一网页中的某一个指定区域的内容? >>>谁知道XAJAX中这个错误是怎么回事??? 请教:关于web页面跳转 开放FTP,欢迎大家上传下载! php如何通过自身网页内部实现百度搜索功能 怎么给session循环赋值 include_path='.:/usr/share/php:/usr/share/pear'
然后我改了php.ini把mysql.dll和mysqli.dll打开了,还改了其他的配置
这是下的代码,我也不是很清楚,但是不是写了echo吗
这是正确的,php 代码不会出现在浏览器中!
<head>
<meta http-equiv="Content-Type" content="text/html; charsetgb2312" />
<title>商品内容页</title>
<link href="images/style.css" rel="Stylesheet" type="text/css" />
</head>
<body style="margin:0px 0px 0px 0px; text-align:center">
<table border="1" cellspacing="0" cellpadding="0" style="width:100%">
<tr><td width="250px">
<?php require ('sub_newslist1.php');
require ('sub_newslist2.php');
require ('sub_productlist3.php');?> </td>
<td valign="top" width="750px">
<table border="1" cellspacing="0" cellpadding="0" width="100%">
<?php
require_once("conn/Conn_DB.php"); //包含数据库链接文件
if($_GET["P_ID"]!="")
{
$pid = $_GET["P_ID"]; //商品编号
$str = "select * from Product_Info where P_ID =".$pid; //查询语句
$arr = mysql_query( $str); //执行SQL语句
$result = mysql_fetch_array($arr); //获取查询结果
?>
</table>
<table border="1" cellspacing="0" cellpadding="0" width="100%">
<tr><td rowspan="4" width="300px"><img src='<?php echo $result["P_Image"];?>' width="250px" height="250px"/> </td>
<td width="450px"> <?php echo $result["P_Name"];?> </td></tr>
<tr><td> 市场价: <?php echo $result["P_MPrice"];?>
会员价: <?php echo $result["P_VPrice"];?> </td></tr>
<tr> <td> <?php echo $result["P_CreateTime"];?> </td></tr>
<tr> <td><a class="a1" href="shopcar_info.php?P_ID=<?php echo $result["P_ID"];?>">放入购物车</a></td></tr>
<tr><td colspan="2">商品详细介绍</td></tr>
<tr><td colspan="2"> <?php echo $result["P_Intro"];?> </td></tr>
<tr><td colspan="2"> <a class="a1" href="javascript:history.back(-1);" target="_self">返回</a> </td></tr>
<?php
}
?>
</table>
</td></tr></table>
</body>
</html>