我有一个简单的模态对话框,我在自己的linux服务器上开发,运行php 5.3.脚本(如下所示)在我的服务器上运行正常.但是,我将它移动到我的客户端的linux服务器,而不是回显它显然应该做的文本/ html,它从>(大于)字符回显所有实际的PHP代码.有谁知道为什么它会回应实际代码?有没有导致这个的php.ini设置?或两个设置中的文件编码差异?
<?php
$to_email = 'myname@myemail.com';
$link = $_GET['link'];
if(!$link){
echo '<p>Have a suggestion?<br />Enter the URL below!</p>';
}else if(strlen($link) > 256 || !preg_match('/^(http:\/\/)?subdomain\.somesite\.com\/(somedir\/)?anotherdir\/(.+)/',$link) && !preg_match('/^(http:\/\/)?somedomain2\.com\/somedir2\/(.+)/',$link)){
echo '<p class="error">Whoops, the URL entered doesn\'t <br />match the criteria.</p>';
}else{
$link = str_replace("\n.", "\n..", $link);
if(!preg_match('/^http:\/\//',$link)){
$link = 'http://'.$link;
}
mail($to_email, 'New URL Suggestion', "A new URL has been suggested from your site:\n\n".$link,"From: ".$to_email."\r\n");
echo '<p>Thank you for submitting this URL! <br />It should be live within 24 hours.</p>';
}
?>
Run Code Online (Sandbox Code Playgroud)
我客户端服务器上的结果是:
256 || !preg_match('/^(http:\/\/)?subdomain\.somesite\.com\/(somedir\/)?anotherdir\/(.+)/',$link) &&
!preg_match('/^(http:\/\/)?somedomain2\.com\/somedir2\/(.+)/',$link)){ echo '
Whoops, the URL entered doesn\'t
match the criteria.
'; }else{ $link = str_replace("\n.", "\n..", $link);
if(!preg_match('/^http:\/\//',$link)){ $link = 'http://'.$link; } mail($to_email,
'New URL Suggestion', "A new URL has been suggested from your site:\n\n".$link,"From:
".$to_email."\r\n"); echo '
Thank you for submitting this URL!
It should be live within 24 hours.
'; } ?>
Run Code Online (Sandbox Code Playgroud)
听起来像其他服务器没有配置为运行PHP.在配置中是否有这样的行?
AddType application/x-httpd-php .php .html .htm
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
142 次 |
| 最近记录: |