


先自我介绍一下吧,我叫海霆,英文名Hetty,我的爱好是……好了,打住,还是跳过吧,免得被人骂的,呵呵。
也许有人会奇怪,为什么教程的名字会叫《PHP边学边教》呢?原因很简单,我也在学嘛,大家共同学习、共同交流、共同进步就是我所期望的了。
我记得一个恩师跟我说过一句话:“你在教别人的同时,自己也会得到很大的提升!”所以我写这篇烂教程的目的很明确,就是:1、巩固自己的PHP基础知识;2、希望尽可能给需要的人一些帮助。(所以大家学习的过程中,也要多跟别人分享学习经验哦!)
这个小教程不会深入去学习那些令人头大的理论知识,只学习一些最基本,最实用的东西,其他的就先不管了。因为这些东西容易入门,一旦入门了,大家把兴趣提起来了,就可以无师自通,继续深入自学了。我会准备大量的实例来讲解语法,而且每个语句都详细说明是干什么用的,要怎么去用,让大家清清楚楚,明明白白,不会晕忽。争取在三天之内,让大家学会写带数据库的通讯录,之后再写留言本,会员系统之类的常用模块。
教程将在官方网站www.hetty.cn每天定时更新,让大家每天都有新的东西可学。教程的具体位置请在进站后点击“快速分类 —> PHP”大家可以对每天的教程发布评论,比如分享一下自己的学习经验啊,教程里有什么不明白的地方需要问啊,或者教程有里什么不足之处需要指正之类的。总之,重在交流。还是那句话:共同学习、共同交流、共同进步!
大家可以任意拷贝、转载这个教程,但请注明作者及出处,体谅下作者的辛劳哟。当然你不注明我也没办法,呵呵。好了,说了这么多废话,该转如正题了,我们开始吧。
什么是PHP:首先,大家可能想了解,到底什么是PHP呢?这个其实你不用去深入了解,背它的英文全名啦,查它英文含义啦,怪麻烦的,你只要知道PHP是用来做动态网站的东东,它可以在线更新你的网站,可以用来储存数据和获取数据就好。学会了它,你就不再需要一页一页的去做网页了,而且可以根据你的想法实现许多有趣的功能哦。
为什么选择PHP:那么为什么要用PHP呢,这个嘛,我个人认为是个人喜好,PHP、ASP、JSP和现在流行的ASP.net各有各的优点,不能一味的去否决哪一个,那样是不理智的。白猫黑猫,能逮耗子就是好猫。只要学好了,无论哪一种都可以实现你的想法。
OK,我们现在需要做一些准备工作,去下载一些东东先把PHP环境配置出来,才能继续学习PHP。注意,由于以下软件经常更新,可能有版本差别,教程图片仅做参考。
1、Apache官方下载:http://httpd.apache.org/download.cgi

说明:如果你用的操作系统是Unix,请下载Unix Source,有两个,他们只是格式不同,任意下其中一个;如果你的操作系统是Windows,那么请下载Win32 Source或Win32 Binary (MSI Installer),第一个是ZIP压缩格式的,第二个是安装程序,比较傻瓜化一点。由于我用的是Windows操作系统,以此为例,为方便安装,我们下载:Win32 Binary (MSI Installer)
2、PHP官方下载:http://www.php.net/downloads.php

这里不再多作说明,我们将以下载PHP 5.2.0 zip package 的ZIP压缩文件为例进行安装。
3、MySQL官方下载:http://dev.mysql.com/downloads/


No further explanation here. Find Windows Essentials (x86) and click the corresponding Download on the right to download directly.
4. Zend Optimizer official download: http://downloads.zend.com/optimizer/
Haha, downloading was originally very troublesome, so I’ve deducted an address here. When you see the download interface of all versions, you can see the latest version. The latest version I currently see is 3.0.2. Click on it, and then you will see a bunch of different installation packages. We only need one of them: ZendOptimizer- 3.0.2-Windows-i386.exe Download it.

If you don’t care about the latest version, please click here to download directly:
http://downloads.zend.com/optimizer/3.0.0/ZendOptimizer-3.0.0-Windows- i386.exe
5. Smarty official download: http://smarty.php.net/download.php

Pay attention here: If you bravely click on Smarty 2.6.14 Source, you may not be able to download it because it is in tar.gz format. Please use "right mouse button -> Save target as" on the connection to download, or use tools such as Xunlei to download. After downloading, you can use WinRAR compression software to open it. Latest Stable Release represents the latest version.
6. phpMyadmin official download: http://www.phpmyadmin.net

Here you can see the latest version of phpMyadmin. Click zip and select a server to download. It is recommended to choose Asia (Asian server). Click Download to download.
7. Appserv official download: http://www.appservnetwork.com/ (click the Download column after entering the official website)
or click here directly: http://sourceforge .net/project/showfiles.php?group_id=37459&package_id=29748

Click appserv-win32-2.5.7.exe to download it directly, or you can click the green little thing to choose a closer server to download. Have you noticed that the official address and download address of Appserv are not consistent? Haha, it still feels weird.
Why do I have to take such pains to teach you how to download all this stuff from the official website? Some people may say that if you search on Baidu and Google, you can find the download address everywhere. Isn't this faster and more convenient? Haha, let me tell you why I do this now: go directly to the official address to download, you can avoid virus files, and more importantly, you can download the latest version and observe the version dynamics. Of course, this does not mean that the latest is the best.
Okay, now we are finally done with all the preparation work. It’s really rare that you all have the patience to read this small tutorial. Take a rest and put the downloaded things in a folder and save them. OK. In the next article, we will explain how to configure the PHP environment under Apache, how to configure the PHP environment under IIS, and how to configure Appserv for fools. Remember to pay attention to the latest tutorials on www.hetty.cn, haha.


php把负数转为正整数的方法:1、使用abs()函数将负数转为正数,使用intval()函数对正数取整,转为正整数,语法“intval(abs($number))”;2、利用“~”位运算符将负数取反加一,语法“~$number + 1”。

实现方法:1、使用“sleep(延迟秒数)”语句,可延迟执行函数若干秒;2、使用“time_nanosleep(延迟秒数,延迟纳秒数)”语句,可延迟执行函数若干秒和纳秒;3、使用“time_sleep_until(time()+7)”语句。

php除以100保留两位小数的方法:1、利用“/”运算符进行除法运算,语法“数值 / 100”;2、使用“number_format(除法结果, 2)”或“sprintf("%.2f",除法结果)”语句进行四舍五入的处理值,并保留两位小数。

判断方法:1、使用“strtotime("年-月-日")”语句将给定的年月日转换为时间戳格式;2、用“date("z",时间戳)+1”语句计算指定时间戳是一年的第几天。date()返回的天数是从0开始计算的,因此真实天数需要在此基础上加1。

php判断有没有小数点的方法:1、使用“strpos(数字字符串,'.')”语法,如果返回小数点在字符串中第一次出现的位置,则有小数点;2、使用“strrpos(数字字符串,'.')”语句,如果返回小数点在字符串中最后一次出现的位置,则有。

方法:1、用“str_replace(" ","其他字符",$str)”语句,可将nbsp符替换为其他字符;2、用“preg_replace("/(\s|\ \;||\xc2\xa0)/","其他字符",$str)”语句。

php字符串有下标。在PHP中,下标不仅可以应用于数组和对象,还可应用于字符串,利用字符串的下标和中括号“[]”可以访问指定索引位置的字符,并对该字符进行读写,语法“字符串名[下标值]”;字符串的下标值(索引值)只能是整数类型,起始值为0。

在PHP中,可以利用implode()函数的第一个参数来设置没有分隔符,该函数的第一个参数用于规定数组元素之间放置的内容,默认是空字符串,也可将第一个参数设置为空,语法为“implode(数组)”或者“implode("",数组)”。


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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

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

Dreamweaver CS6
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
