Home  >  Article  >  Backend Development  >  PHP学习札记 01

PHP学习札记 01

WBOY
WBOYOriginal
2016-06-13 10:47:41856browse

PHP学习笔记 01
PHP集成安装环境 AppServ,内置了apache、mysql、php脚本解析工具。
开发工具: Zend Studio。下载地址:http://www.zendstudio.net/。
将workspace设定为php www目录,方便进行调试。

设定Zend模板。
设定代码提示。


%>
写php代码。


// 单行注释
/* */ 多行注释

先浏览器输出
echo ""; 运行速度稍微快一些 echo 单引号,直接输入,不转换
print ""; 返回整型值

变量以 $ 开头,无需定义变量类型。

数据类型转换
变量前增加类型,可强制转换,如(float)$num

gettype() 获取变量类型
settype() 也可以做类型转换

isset() 判断变量是否存在
unset() 销毁变量

empty() 判断变量值是否为空,支持string,integer,array

类型判断函数:
is_integer
is_int
is_array
is_null
.....

数据类型转换函数:
intval();
floatval();
strval();

将转换后的数据赋予新变量,settype转换原始变量

define() 常量定义,常量名一般为大写字母。常量不能修改。

访问表单变量:

$_POST["name"]
$_GET["name"]

字符串连接 '.'



Statement:
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