Home php教程 php手册 php文件怎么打开 如何执行php文件

php文件怎么打开 如何执行php文件

Jun 13, 2016 pm 12:04 PM
php What how how Open implement document yes English language preprocessing

什么是php:

PHP,是英文超级文本预处理语言Hypertext Preprocessor的缩写。PHP 是一种 HTML 内嵌式的语言,是一种在服务器端执行的嵌入HTML文档的脚本语言,语言的风格有类似于C语言,被广泛的运用。
php就是网络上大家常说的后台,用来处理数据库等,很多网站都是用php写的,包括www.baidu.com,www.jb51.net等网站,都是使用php语言写的。我们的文章都是通过php代码上传到服务器数据库中,然后通过php代码生成静态的。

php文件如何打开:

简单一句话php跟txt(文本文档)一样,记事本就可以打开,但看到的就是代码,而不是php执行后的效果了,例如 我们打开test.php代码 因为编码有gbk或utf8格式的,用记事本打开utf8格式的php文件时,当有中文的时间就是出现乱码,所以我们建议用dreameweaver或editplus等支持utf8格式文件的软件打开。(普通用户选择editplus打开即可,因为editplus比较小)

一段php测试代码

复制代码 代码如下:


for($i=1;$iecho $i.'
';
}
echo "www.jb51.net";
?>


但是大家目的往往不是想看到这样的代码,如果想看到执行后的效果,就需要配置php运行环境了。
大家访问的www.jb51.net都是服务器端事先配置好的php运行环境,可能是linux也可能是windows,大家在购买空间的时候问下idc商,问他们是否支持php,要不以后购买了不支持php的空间,也是无法支持php的。

如果大家是本地测试php代码的,大家可以用一些工具例如phpnow等(phpnow安装使用比较简单,安装以后将php文件复制到htdocs目录,在浏览器中输入http://127.0.0.1即可,如果选择了端口需要加入端口http://127.0.0.1:端口号),iis也可以,但需要稍专业的人员来配置。这里我们也为大家提供一下iis php运行环境。前提是您的电脑中有iis,一般默认个人电脑都是没有安装的,支持iis的操作系统一般是 winxp,win2003系统。

如果架设好了php运行环境,在浏览器中输入网址,就可以看到php的运行效果(注:大家在浏览器中输入的网址可能不一样,我们这个是内网ip)
如下图所示:


很多没有基础的朋友,经常会问php文件怎么打开,其实PHP是一个网页脚本,但不同于html xml 标签语言,直接可以通过浏览器打开,需要有PHP运行环境才可以访问和打开文件,如果只是编辑PHP打开文件,只需要用记事本或者通过相关的编辑器如(DW、EclipsePHP、editplus 等)打开编辑即可。

再来介绍PHP是什么,增加点PHP基础知识,PHP,是英文超级文本预处理语言Hypertext Preprocessor的缩写。PHP 是一种 HTML 内嵌式的语言,是一种在服务器端执行的嵌入HTML文档的脚本语言,语言的风格有类似于C语言,被广泛的运用。PHP的另一个含义是:菲律宾比索的标准符号。

我们在学习网站建设的时候,初期接触较多的肯定是HTML语言,动态语言肯定是ASP。但随着网络的发展,以及主机方向的转变,尤其是海外主机较多的还是LINUX系统,WIN系统很少,而且很贵。所以迫使我们也去选择LINUX主机,使用PHP语言的程序。有些朋友提问,PHP语言的网站怎么打开。这个问题其实很简单,不管用什么语言网页,我们都可以用DW或者EDITPLUS或者记事本打开。
但调试PHP程序不同于ASP这么简单,我们可以直接在PHP空间调试或者安装本地环境,我现在使用的PHPNOW或者WAMPSERVER,都是不错的工具。
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

7 PHP Functions I Regret I Didn't Know Before 7 PHP Functions I Regret I Didn't Know Before Nov 13, 2024 am 09:42 AM

If you are an experienced PHP developer, you might have the feeling that you’ve been there and done that already.You have developed a significant number of applications, debugged millions of lines of code, and tweaked a bunch of scripts to achieve op

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Apr 05, 2025 am 12:04 AM

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

How do you parse and process HTML/XML in PHP? How do you parse and process HTML/XML in PHP? Feb 07, 2025 am 11:57 AM

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

PHP Program to Count Vowels in a String PHP Program to Count Vowels in a String Feb 07, 2025 pm 12:12 PM

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

Explain late static binding in PHP (static::). Explain late static binding in PHP (static::). Apr 03, 2025 am 12:04 AM

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

What are PHP magic methods (__construct, __destruct, __call, __get, __set, etc.) and provide use cases? What are PHP magic methods (__construct, __destruct, __call, __get, __set, etc.) and provide use cases? Apr 03, 2025 am 12:03 AM

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.

See all articles