Home php教程 php手册 PHP学习笔记(一) 简单了解PHP

PHP学习笔记(一) 简单了解PHP

Jun 06, 2016 pm 08:19 PM
learn study notes Simple

本系列文章将从易到难,从浅入深,循序渐进的将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个字符

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 Article Tags

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)

The easiest way to query the hard drive serial number The easiest way to query the hard drive serial number Feb 26, 2024 pm 02:24 PM

The easiest way to query the hard drive serial number

How to delete Xiaohongshu notes How to delete Xiaohongshu notes Mar 21, 2024 pm 08:12 PM

How to delete Xiaohongshu notes

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? 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? Mar 21, 2024 pm 09:30 PM

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 How to add product links in notes in Xiaohongshu Tutorial on adding product links in notes in Xiaohongshu Mar 12, 2024 am 10:40 AM

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 Learn to completely uninstall pip and use Python more efficiently Jan 16, 2024 am 09:01 AM

Learn to completely uninstall pip and use Python more efficiently

Revealing the appeal of C language: Uncovering the potential of programmers Revealing the appeal of C language: Uncovering the potential of programmers Feb 24, 2024 pm 11:21 PM

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

Getting Started with Pygame: Comprehensive Installation and Configuration Tutorial Getting Started with Pygame: Comprehensive Installation and Configuration Tutorial Feb 19, 2024 pm 10:10 PM

Getting Started with Pygame: Comprehensive Installation and Configuration Tutorial

How to publish notes tutorial on Xiaohongshu? Can it block people by posting notes? How to publish notes tutorial on Xiaohongshu? Can it block people by posting notes? Mar 25, 2024 pm 03:20 PM

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

See all articles