所以我的 PHP 项目正在下载该项目localhost而不是加载它,它将它下载为...这里是文件:localhost/project/index.phpdownloaddownload
<?php
/*
* Index.php - Define the directories
*
*
* DS, DIRECTORY_SEPARATOR = /
* ROOT, dirname = string containing the path of a file or directory
* __FILE__ = The full path and filename of the file. If used inside an include, the name of the included file is returned
*
* In this file we load the apporpriate files that our website wants to load and render the
* template with informatio from the database. We load the bootstrap.php from the library folder.
*
* We are not including the ?\> to avoid injection of any extra whitespaces in our output.
*
*
*/
define('DS', DIRECTORY_SEPARATOR);
define('ROOT', dirname(dirname(__FILE__)));
$url = $_GET['url'];
require_once (ROOT . DS . 'library' . DS . 'bootstrap.php');
Run Code Online (Sandbox Code Playgroud)
并加载localhost下载:
<?php
if (!empty($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS'])) {
$uri = 'https://';
} else {
$uri = 'http://';
}
$uri .= $_SERVER['HTTP_HOST'];
header('Location: '.$uri.'/xampp/');
exit;
?>
Something is wrong with the XAMPP installation :-(
Run Code Online (Sandbox Code Playgroud)
我有同样的问题(使用 Ubuntu 12.04)并且 .htaccess 中也有一行像 pi4r0n,例如,
AddHandler application/x-httpd-php54s .php
Run Code Online (Sandbox Code Playgroud)
XAMPP 没有与AddHandler命令调用的 PHP 版本相同的版本(我的是 v5.3.8)。我发现将其注释掉,就像 pi4r0n 所做的那样,即
# AddHandler application/x-httpd-php54s .php
Run Code Online (Sandbox Code Playgroud)
将允许它在本地服务器上工作。您只需要记住在上传之前进行更改即可。
小智 1
伙计们,我也遇到了完全相同的问题,就我而言,这是 htaccess 文件。我错误地从我的服务器(cPanel 服务器)下载了它,htaccess 看起来像这样
# 使用 PHP5.4 作为默认 AddHandler application/x-httpd-php54 .php
但因为我没有在 XAMPP 本地安装 PHP5.4,所以它不知道如何处理该文件。
所以我的建议是确保您的htaccess文件(如果有)已删除或正确;)
| 归档时间: |
|
| 查看次数: |
13817 次 |
| 最近记录: |