我是网络编程的新手,仍在学习新东西.
I am a new guy in web programming who still learning new stuff.
我正在创建一个包含一个 INPUT 的 Web 表单.我将 HTML 文件中的表单连接到 php 文件.我正在使用我最近在 MacBook 上安装的本地主机 MAMP.
I am creating a web form that consist of one INPUT. I connected the form in the HTML file to the php file. I am using a localhost MAMP that I recently installed on my MacBook.
问题: 当我在网页上打开 HTML 文件并在输入框中输入内容并点击提交时,浏览器要求我下载 php 文件而不是处理它.
The Problem : When I open the HTML file on a webpage and type something on the input box and hit submit, the browser ask me to download the php file rather processing it.
我认为问题与 mysql 或 apache 无关,因为当我运行 MAMP 时,它会在 apache 和 mysql 旁边给我绿色标志.
I don’t think the problem is related to mysql or apache since when I run the MAMP it give me green signs next to the apache and mysql.
有谁知道我如何解决这个问题并让 php 文件打开并将输入传输到数据库?
Do anyone know how I can fix this problem and the let the php file open and transfer inputs to the database?
您需要确保 Apache 已被告知 .php 文件应被视为 PHP 脚本.这意味着以下之一:
You'll want to make sure that Apache has been told that .php files should be treated as PHP scripts. That means one of the following:
LoadModule php5_module modules/libphp5.so # on windows, this'd be a .dll instead
AddHandler php5-script php
和/或
AddType application/x-httpd-php php
在您的 httpd.conf 文件中.
in your httpd.conf file.
这篇关于浏览器要求我下载 php 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
PHP、MySQL PDOException 的死锁异常代码?Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死锁异常代码?)
PHP PDO MySQL 可滚动游标不起作用PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滚动游标不起作用)
PHP PDO ODBC 连接PHP PDO ODBC connection(PHP PDO ODBC 连接)
使用 PDO::FETCH_CLASS 和魔术方法Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔术方法)
php pdo 只从 mysql 获取一个值;等于变量的值php pdo get only one value from mysql; value that equals to variable(php pdo 只从 mysql 获取一个值;等于变量的值)
MSSQL PDO 找不到驱动程序MSSQL PDO could not find driver(MSSQL PDO 找不到驱动程序)