我使用 XAMPP 在 phpMyAdmin 中创建了一个包含多个表、多个页面和文件(html、php、jquery、javascript、css)的网站。
我将所有文件保存在 XAMPP 文件夹的 htdocs 文件夹中,并使用以下命令创建了一个 .htaccess 文件:
RemoveHandler .html .htm
AddType application/x-httpd-php .html .htm
以及其中的其他行(不会以任何方式干扰这两行。 我尝试过使用和不使用这两行。
我是 XAMPP 新手。
在为网站创建所有文件和页面时,一切都运行得很完美。我完成了网站。但是,一旦我将文件(包含 XAMPP 和我的所有网站文件)复制到我们的服务器,PHP 将无法运行。它不会脱离服务器运行,也不会脱离存储文件的计算机运行。
HTML文件注释掉部分PHP,其他PHP作为内容写入网页 PHP文件显示所有PHP代码
PHP 运行良好,直到我复制包含 XAMPP 的文件夹
我使用 来关闭文件。
非常感谢任何对此的帮助。
最佳答案
嗯...好吧,当我想将我的项目从我的笔记本电脑复制到另一台笔记本电脑时,您只需复制我保存项目的目录....我的方法是在我想要复制的计算机中安装一个新的 xampp然后你去...
C:/xampp/htdocs/(find your project directory and copy the entire directory)
在另一台计算机的新xampp中以相同的方式粘贴
C:/xampp/htdocs/(here you paste your work)
然后您可以从 xampp 导出表并将文件加载到新的 xampp 中...为了尝试安装,让我们在 xampp 中添加一些测试内容
将其复制到新项目中并创建一个文件作为索引
复制此内容
<div>
<h3 align="center"><strong align="center">Bienvenido</strong></h3>
<table align="left" width="50px">
<tr>
<td width="20px">
<h3 align="right" style="font-size:18px"><strong align="center">Bienvenido 1</strong></h3>
</td>
<td>
<h3 align="left" style="font-size:18px">hola 1</h3>
</td>
</tr>
<tr>
<td width="20px">
<h3 align="right" style="font-size:18px"><strong align="center">Bienvenido 2</strong></h3>
</td>
<td>
<h3 align="left" style="font-size:18px">Hola 2</h3>
</td>
</tr>
</table>
<?php echo "hoja de pruebaaaaaa";?>
试试这个,看看会发生什么......
关于php - XAMPP - PHP 被复制后停止工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24142050/