How to execute PHP script?

怪我咯
Release: 2023-03-10 18:56:01
Original
9138 people have browsed it

How to open the php file:
Make sure that the php operating environment is installed on the computer, such as: wampserver, phpstudy, etc.
After installation, copy the php file Enter the corresponding directory (usually under the www directory);
Enter localhost/ on the browser and add your php file path (localhost here represents the www directory, you only need to complete the following path), Press enter, and the php script will be automatically parsed and run.

How to open the php file:
In a simple sentence, php is the same as txt (text document). Notepad can open it, but What you see is the code, not the effect after php is executed. For example, when we open test.php code, because the encoding is in gbk or utf8 format, when using Notepad to open the php file in utf8 format, when The Chinese time is garbled, so we recommend opening it with software that supports UTF8 format files such as Dreameweaver or EditPlus. (Ordinary users can choose editplus to open it, because editplus is relatively small)
A piece of php test code

<?php 
for($i=1;$i<=10;$i++){ 
echo $i.&#39;<br />&#39;; 
} 
?>
Copy after login

But everyone’s purpose is often not to see such code. If you want to see the effect after execution, just It is necessary to configure the php operating environment.
The www.jb51.net you visit is a pre-configured PHP operating environment on the server side, which may be Linux or Windows. When purchasing space, please ask the IDC provider if they support PHP. Otherwise, If you purchase a space that does not support PHP in the future, it will not be able to support PHP.

If you are testing the php code locally, you can use some tools such as phpnow (phpnow is relatively simple to install and use. After installation, copy the php file to the htdocs directory and enter http://127.0 in the browser .0.1 is enough. If you select a port, you need to add the port http://127.0.0.1: port number). IIS can also be used, but it requires a slightly more professional person to configure it. Here we also provide you with the iis php running environment. The premise is that your computer has iis, which is generally not installed on personal computers by default. The operating systems that support iis are generally winxp and win2003 systems.

If you have set up the php operating environment and enter the URL in the browser, you can see the running effect of php (note: the URL you enter in the browser may be different, ours is the intranet IP )
As shown below:

How to execute PHP script?

Many friends who have no basic knowledge often ask how to open PHP files. In fact, PHP is a web script, but it is different from html xml Tag language can be opened directly through the browser. You need a PHP running environment to access and open the file. If you only edit PHP to open the file, you only need to use Notepad or use a related editorsuch as (DW, EclipsePHP, editplus, etc.) just open it for editing.

Let’s introduce what is PHP and add some basic knowledge of PHP. PHP is the abbreviation of the English hypertext preprocessing language Hypertext Preprocessor. PHP is an HTML embedded language. It is a scripting language that is embedded in HTML documents and executed on the server side. The style of the language is similar to C language and is widely used. Another meaning of PHP is: The standard symbol for the Philippine peso. When we were learning website construction, the language we came into contact with most in the early stage was definitely HTML, and the dynamic language was definitely ASP. However, with the development of the network and the change in the direction of hosts, especially overseas hosts have more LINUX systems, while WIN systems are rare and very expensive. Therefore, we are forced to choose LINUX host and use PHP language program. Some friends asked how to open a website in PHP language. This problem is actually very simple. No matter what language the web page is in, we can open it with DW or EDITPLUS or Notepad.
But debugging PHP programs is not as simple as ASP. We can debug directly in the PHP space or install the local environment. The PHPNOW or WAMPSERVER I am using now are both good tools.

The above is the detailed content of How to execute PHP script?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template