学习php前亟需了解的知识
学习php前需要了解的知识
1.静态网站与动态网站
A)静态网站:
不支持数据交互的网站(后缀: .html .htm)
B)动态网站:
支持数据交互的网站,动态网站可以放静态网页的
i.实现动态网站的技术
1.Asp .asp
2.php .php
3. .net .aspx
4.Java .jsp
2.客户端与服务器端
A)客户端:浏览者使用的计算机
B)服务器端:存放网站代码的机器
C)客户端给服务器发送一个请求,(HTTP请求),服务器会把静态资源(html、代码、图片、js、CSS)发送到客户端(HTTP响应),客户端通过浏览器解析返回的代码,就形成了我们看到的页面。
3.端口和端口号
A)端口就是服务运行的入口,类似于大楼的门
B)端口号:门的门牌号。范围为0~65535
C)如何查询端口号是否被利用。
Win+R后输入cmd进入命令行
输入netstat -ano
D)80端口一般留给WEB服务器用,21端口留给FTP用,25端口留给邮件服务器用。
4.BS和CS架构
A)BS架构
B:brower 浏览器
S:sever 服务器
通过浏览器访问服务器
B)CS架构
C:client 客户端
S:sever 服务器
通过一个客户端软件访问服务器
例:qq、炒股软件
5.前台和后台
A)前台:浏览器看到的界面
B)后台:管理员操作的界面,后台用来操作前台的数据
6.站点、虚拟目录、虚拟主机
A)站点:存放网站内容的文件夹
B)虚拟目录:有权限的文件夹
C)虚拟主机:有权限的文件夹+域名+端口
7.更改虚拟目录
因为PHP的运行需要apache的支持,所以php的目录要告知apache,在apache大的配置文件中配置php的虚拟目录
打开apache的配置文件,搜索documentroot(配置文件中是不区分大小写的)
在浏览器地址栏中输入http://localhost/text.php(修改后的虚拟目录),发现无法打开指定页面的原因:没有给更改的目录设置访问权限
解决:在apache配置文件中,将指定文件夹的权限设定为 allow from all
更改方法:
1.找到wampwerver\bin\apache\apache2.4.9\conf\下的http.conf,打开后,输入vhosts 进行查找,找到下图所在的地方,去掉前面的#
2.找到wampserver/bin/apache/apache2.4.9/conf/extra下面的httpd-vhosts.conf,打开并在文本的最后添加如下代码
DocumentRoot "D:/wamp/www/web1/"
DirectoryIndex wo.php
ServerName www.sina.com
3.修改C:/WINDOWS/system32/drivers/etc/host这个文件,用记事本打开,加上如下内容:
127.0.0.1 www.sina.com
注释:D:/wamp/www/web1/ 是网站项目的根目录
7.更改主页
在apache的配置文件中查找directoryindex,这个指令是设置网站首页。
9.更改监听端口
Listen
浏览器请求的格式:http://网址[:端口号]/php页面
如果是端口号80,那么端口号可以省略。
10.DNS解析
A)DNS:域名解析系统。浏览器输入域名,先到最近的DNS服务器上解析出域名对应的 IP地址(最近的DNS解析服务器就是本机),再通过IP地址去访问服务器。
本机的DNS解析数据库在“C:\Windows\System32\drivers\etc\hosts”
11.PHP语法的特点
PHP的关键字不区分大小写,变量名区分大小写

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

To set up a CGI directory in Apache, you need to perform the following steps: Create a CGI directory such as "cgi-bin", and grant Apache write permissions. Add the "ScriptAlias" directive block in the Apache configuration file to map the CGI directory to the "/cgi-bin" URL. Restart Apache.

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

The steps to start Apache are as follows: Install Apache (command: sudo apt-get install apache2 or download it from the official website) Start Apache (Linux: sudo systemctl start apache2; Windows: Right-click the "Apache2.4" service and select "Start") Check whether it has been started (Linux: sudo systemctl status apache2; Windows: Check the status of the "Apache2.4" service in the service manager) Enable boot automatically (optional, Linux: sudo systemctl

PHP is used to build dynamic websites, and its core functions include: 1. Generate dynamic content and generate web pages in real time by connecting with the database; 2. Process user interaction and form submissions, verify inputs and respond to operations; 3. Manage sessions and user authentication to provide a personalized experience; 4. Optimize performance and follow best practices to improve website efficiency and security.

To delete an extra ServerName directive from Apache, you can take the following steps: Identify and delete the extra ServerName directive. Restart Apache to make the changes take effect. Check the configuration file to verify changes. Test the server to make sure the problem is resolved.

When the Apache 80 port is occupied, the solution is as follows: find out the process that occupies the port and close it. Check the firewall settings to make sure Apache is not blocked. If the above method does not work, please reconfigure Apache to use a different port. Restart the Apache service.

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.
