PHP学习笔记(一) 简单了解PHP
Jun 06, 2016 pm 08:19 PM本系列文章将从易到难,从浅入深,循序渐进的将PHP一步步介绍给大家,希望大家能喜欢
目标规划:
通过第一节课,我们可以了解php环境.
1.环境的认识:
2.访问方法:
3.修改代码及查看.
4.变量的使用
5.代码缩进要有层次关系,而且代码之间最好保留空行
6.变量命名:
7.变量的输出:
8.变量的三种方法:
1.环境的认识:
软件下载地址:
安装教程非常简单,可以自己百度一下
安装之后的目录结构:
2.访问方法:
直接在浏览器输入:localhost 即可访问
3.修改代码及查看.
我们可以修改上面目录www中的index.php
php输出html代码:
"; echo "Hello world"; echo "/html"; ?>
建议写法
4.变量的使用
5.代码缩进要有层次关系,而且代码之间最好保留空行
6.变量命名:
6.1.尽量不要使用中文
6.2.尽量不用数字开头
6.3.尽量不要使用无意义字母
6.4.变量名会区分大小写,,函数名不区分大小写,类名也不能区分大小写,干脆变量名和函数全小写。
6.5.变量的定义 定义必须加$
7.变量的输出:
echo $name;
8.变量的三种方法:
echo($name); //输出变量
var_dump($name);//输出数组,并且打印类型和长度
print_r($name);//输出数组
example:
显示如下
通过上面的显示,我们可以看出显示非常的不美观,而且不用一阅读,所以格式化输出方案:
"; print_r($arr); echo ""; ?>
显示结果如下:
小知识:
Utf-8 编码时,一个中文字是3个字符
gbk编码时,一个中文是2个字符

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

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

The easiest way to query the hard drive serial number

What should I do if the notes I posted on Xiaohongshu are missing? What's the reason why the notes it just sent can't be found?

How to add product links in notes in Xiaohongshu Tutorial on adding product links in notes in Xiaohongshu

Learn to completely uninstall pip and use Python more efficiently

Revealing the appeal of C language: Uncovering the potential of programmers

Getting Started with Pygame: Comprehensive Installation and Configuration Tutorial

How to publish notes tutorial on Xiaohongshu? Can it block people by posting notes?
