Table of Contents
以上 8节课按细说PHP来说就是第五章、第六章、第七章
Home Database Mysql Tutorial PHP100视频学习笔记-PHP基础知识部分1-7_MySQL

PHP100视频学习笔记-PHP基础知识部分1-7_MySQL

Jun 01, 2016 pm 01:51 PM
compatibility basic knowledge develop

PHP100视频教程1:环境配置与代码调试

1、PHP的优势和背景

Hypertext Preprocessor

免费、效率高、开发时间短

2、PHP环境的搭配

Linux Windows下都可搭建 多平台兼容性

Apache nginx 等等

3、书写和调试简单的PHP代码 注释

echo “Hello!My world!”;

?>

其他的一些写法

…?> 短标签模式

注释的一些方法

/*…*/

// C风格单行注释

4、如何处理简单的PHP错误 调试

php.ini  里的 display_errors = on 才可以显示错误的位置


PHP100视频教程2:PHP的数据类型与源码调试

1、PHP基本语法和数据类型

一个语句以;(分号结束)

声明自定义变量

$abc = 888;

echo $abc;

?>

声明自定义变量必须以以下方式开头

$_

$A-Z

$a-z

四种标量类型:

boolean(布尔型) $bo=true;$bo=FALSE;     $bo赋值为大于0的数值 为真; $bo赋值为0为假

integer(整型)  $bo=1;$bo=-12;

float(浮点型)  $bo=1.001;$bo=3.1415926;

string(字符串类型) $bo=”这段字符”.$abc

两种复合类型:

array(数组)$bo=array(1,2,3,4);      $bo=array(“A”=>1,”B”=>2);    以后有单独的讲解视频

object  (对象)

2、学习一个PHP源码调试(Discuz论坛)


PHP100视频教程3:常用PHP运算类型介绍与应用

常用PHP运算类型介绍与运用

1、算术运算

从左到右 先算乘除后算加减,遇到括号先算括号内的;

2、赋值运算

把一个值写入一个变量

$a=1;

$a+=2;   $a上面是1 然后$a先于2相加 然后再赋值给$a 结果等于3

$a*=3;   $a上面是3 然后$a先于3相乘 然后再赋值给$a 结果等于9

3、比较运算

确定两个数之间的关系;比较运算得到的值为布尔值;

1==2; FALSE

3!=2; TRUE

5

“ok”==”ok”;  TRUE

1===’1′;  三个等号还要比较数值的类型   后面单引号为字符串类型 FALSE

4、逻辑运算

先将比较的两边转成布尔类型,再执行他们的关系   &逻辑与 |逻辑或

1&&1   输出真 TRUE

0&&1  输出假 FALSE

1||1      输出TRUE

0||1     输出TRUE

0||0    输出FALSE

5、递增递减运算

只操作变量的一种运算

$a++     $a+1再赋值给$a

++$a

$a–

–$a

PHP100视频教程4: PHP条件语句介绍与应用

1、if条件语句

if(expr)

echo   TRUE

else

echo FALSE

if(expr){

echo TRUE

}else{

echo  FALSE

}

if(expr){

echo TRUE

}elseif(expr){

echo  CON

}else{

echo  FALSE

}

2、switch条件语句


PHP100视频教程5:PHP循环语句的介绍与应用

1、break n 循环控制语句

循环中中断语句,跳出循环语句

break;     跳出一层循环

break n;     跳出n条循环

2、do…while 循环语句

do…while   先执行一次循环再判断条件

do{

echo “循环”.++$a;

}

while($a

while(expr){

}                      先判断条件再执行一次循环

3、for循环语句

for(expr1;expr2;expr3){

}                     expr1–>无条件执行   expr2–>比较运算   expr3–>循环条件

for($i=1;$i

echo “循环”.$i.”
”;

}


PHP100视频教程6:PHP数组的创建修改应用

1、创建和修改数组、多维数组

php中的数组是一个关键字或者值得集合   print_r($arr);   打印出数组数值

array(key=>value,key=>value……)

$arr=array(3,4,5,6,7,8);

echo $arr[0];   结果3

$arr=array(“id”=>2,”title”=>3);

echo $arr[‘title’];  结果3

多维数组:

$arr=array(array(3,6),array(2,4));

print_r($arr);

echo $arr[1][0] ;  结果2

修改数组

$arr=array(“a”=>”视频”,“b”=>”教程”);

$arr[0]=“php100”;———

$arr[1]=”php100教程”;

print_r($arr);

2、数组与数组的函数

count($arr);

$arr=array(“a”=>”视频”,“b”=>”教程”);

echo count($arr);

is_array($arr);

if(is_array($arr)){

echo “是数组”;

}else{

echo “不是数组”;

}

explode(“key“,value);

$a=”1986-1983-1980″;

$arr=explode(“-”,$a);

3、使用foreach遍历数组

foreach遍历数组

foreach($arr as $key => $value){

}

$arr=array(1980,1982,1983,1984,1985,1986);

foreach($arr as $key=>$value){

echo $key.”-”.$value.”
”;

}

PHP100视频教程7:PHP函数和自定义函数

1、php函数介绍

函数就是为了解决一些常见问题实现制作好的“模”

php函数分为:系统内部函数 和 自定义函数

func(val1,val2….);    自定义函数

date(Y-m-d);      系统内部函数

md5(“php100″);       php5.3中文参考手册

2、php如何自定义函数

function func_name($val){

………….

}

函数的命名跟自定义变量一样 只能用_,A-Z,a-z.

一个自定义函数中的变量是局部的,函数外不生效

使用global全局变量的时候,在函数外才可以使用变量

为了防止全局变量的混乱可以使用unset($val)删除一个变量

function _pr(){

echo”这是个自定义函数”;

}

function _pr($val1,$val2){

echo”这是个自定义函数”.$val1;

}

自定义函数的命名规则

函数的命名是程序规划的核心。名字就是事物在它所处的生态环境中一个长久而深远的结果。变量及函数的命名是以能表达变量或函数的动作意义为原则的,一般是由动词开头,采用大小写混合的方式,第一个单词的首字母小写,其后单词的首字母大写。

function run();

function runFast();

function getBackground();

函数名称不区分大小写。例如,name()和NAME()指向的是同一个函数,这一点读者一定要注意。如果读者误定义了两个不同大小写的重名函数,程序将中止运行。

函数的参数没有限制,可以定义任意需要的参数数量,也可以无参数值。

名称的开头不能使用数字及特殊符号。

“·”及类型声明等专用语不能作为名称。

变量或程序名的长度必须在255个字符以内。

和保留字相同的名称不能使用。

另外,还有一些函数命名的通用规则。例如,取数,则用Get开头,然后跟上要取的对象的名字;设置数,则用Set开头,然后跟上要设的对象的名字,如GetXxx或SetXxx。

3、使用自定义函数实例操作

(1)使用return函数返回函数内部值

(2)自定义函数值得接受和选择性接收

(3)function_exists()判断函数是否存在

(4)引用返回值 使用&符号     引用全局变量 不适用global

$A=”Today”;

$B=”Monday”;

Function print_A($A,&$ B);{              //使用了&之后 以后的值就全改了

$B=$A.”is”.$B;

echo “函数中变量A与变量B的值为
”;

echo”变量A:$A
”;

echo”变量B:$B
”;

}

print_A($A,$B);

echo”主程序中变量A与变量B的值为
”;

echo”变量A:$A
”;

echo”变量B:$B
”;

?>

以上 8节课按细说PHP来说就是第五章、第六章、第七章

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

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)

Four recommended AI-assisted programming tools Four recommended AI-assisted programming tools Apr 22, 2024 pm 05:34 PM

This AI-assisted programming tool has unearthed a large number of useful AI-assisted programming tools in this stage of rapid AI development. AI-assisted programming tools can improve development efficiency, improve code quality, and reduce bug rates. They are important assistants in the modern software development process. Today Dayao will share with you 4 AI-assisted programming tools (and all support C# language). I hope it will be helpful to everyone. https://github.com/YSGStudyHards/DotNetGuide1.GitHubCopilotGitHubCopilot is an AI coding assistant that helps you write code faster and with less effort, so you can focus more on problem solving and collaboration. Git

Which AI programmer is the best? Explore the potential of Devin, Tongyi Lingma and SWE-agent Which AI programmer is the best? Explore the potential of Devin, Tongyi Lingma and SWE-agent Apr 07, 2024 am 09:10 AM

On March 3, 2022, less than a month after the birth of the world's first AI programmer Devin, the NLP team of Princeton University developed an open source AI programmer SWE-agent. It leverages the GPT-4 model to automatically resolve issues in GitHub repositories. SWE-agent's performance on the SWE-bench test set is similar to Devin, taking an average of 93 seconds and solving 12.29% of the problems. By interacting with a dedicated terminal, SWE-agent can open and search file contents, use automatic syntax checking, edit specific lines, and write and execute tests. (Note: The above content is a slight adjustment of the original content, but the key information in the original text is retained and does not exceed the specified word limit.) SWE-A

Learn how to develop mobile applications using Go language Learn how to develop mobile applications using Go language Mar 28, 2024 pm 10:00 PM

Go language development mobile application tutorial As the mobile application market continues to boom, more and more developers are beginning to explore how to use Go language to develop mobile applications. As a simple and efficient programming language, Go language has also shown strong potential in mobile application development. This article will introduce in detail how to use Go language to develop mobile applications, and attach specific code examples to help readers get started quickly and start developing their own mobile applications. 1. Preparation Before starting, we need to prepare the development environment and tools. head

How compatible is the Go language on Linux systems? How compatible is the Go language on Linux systems? Mar 22, 2024 am 10:36 AM

The Go language has very good compatibility on Linux systems. It can run seamlessly on various Linux distributions and supports processors of different architectures. This article will introduce the compatibility of Go language on Linux systems and demonstrate its powerful applicability through specific code examples. 1. Install the Go language environment. Installing the Go language environment on a Linux system is very simple. You only need to download the corresponding Go binary package and set the relevant environment variables. Following are the steps to install Go language on Ubuntu system:

WIN10 compatibility lost, steps to recover it WIN10 compatibility lost, steps to recover it Mar 27, 2024 am 11:36 AM

1. Right-click the program and find that the [Compatibility] tab is not found in the properties window that opens. 2. On the Win10 desktop, right-click the Start button in the lower left corner of the desktop and select the [Run] menu item in the pop-up menu. 3. The Win10 run window will open, enter gpedit.msc in the window, and then click the OK button. 4. The Local Group Policy Editor window will open. In the window, click the [Computer Configuration/Administrative Templates/Windows Components] menu item. 5. In the opened Windows component menu, find the [Application Compatibility] menu item, and then find the [Remove Program Compatibility Property Page] setting item in the right window. 6. Right-click the setting item, and in the pop-up menu

Understanding VSCode: What is this tool used for? Understanding VSCode: What is this tool used for? Mar 25, 2024 pm 03:06 PM

"Understanding VSCode: What is this tool used for?" 》As a programmer, whether you are a beginner or an experienced developer, you cannot do without the use of code editing tools. Among many editing tools, Visual Studio Code (VSCode for short) is very popular among developers as an open source, lightweight, and powerful code editor. So, what exactly is VSCode used for? This article will delve into the functions and uses of VSCode and provide specific code examples to help readers

Is PHP front-end or back-end in web development? Is PHP front-end or back-end in web development? Mar 24, 2024 pm 02:18 PM

PHP belongs to the backend in web development. PHP is a server-side scripting language, mainly used to process server-side logic and generate dynamic web content. Compared with front-end technology, PHP is more used for back-end operations such as interacting with databases, processing user requests, and generating page content. Next, specific code examples will be used to illustrate the application of PHP in back-end development. First, let's look at a simple PHP code example for connecting to a database and querying data:

Exploring Go language front-end technology: a new vision for front-end development Exploring Go language front-end technology: a new vision for front-end development Mar 28, 2024 pm 01:06 PM

As a fast and efficient programming language, Go language is widely popular in the field of back-end development. However, few people associate Go language with front-end development. In fact, using Go language for front-end development can not only improve efficiency, but also bring new horizons to developers. This article will explore the possibility of using the Go language for front-end development and provide specific code examples to help readers better understand this area. In traditional front-end development, JavaScript, HTML, and CSS are often used to build user interfaces

See all articles