PHP-基础
- 介绍
- 本地环境安装
- 安装 WNMP 环境
- 代码编辑器选择
- 语法
- 变量与常量
- 常见输出函数
- 数据类型之四种标量类型
- 数据类型之三种复合类型
- 数据类型之两种特殊类型
- Operators:运算符
- 流程控制:条件判断语句
- 流程控制:循环语句
- 流程控制:中止语句
- 函数
- 类和对象:基本概念
- 类和对象:类结构
- 类和对象:面向对象
- 类和对象:三种特殊类
- 类和对象
- 类和对象:Trait
- 类和对象:魔术方法
- 命名空间
- 【实战】PHP表单
PHP-函数
-
String
- addcslashes()
- addslashes()
- bin2hex()
- chop()
- chr()
- chunk_split()
- convert_cyr_string()
- convert_uudecode()
- convert_uuencode()
- count_chars()
- crc32()
- crypt()
- echo
- explode()
- fprintf()
- get_html_translation_table()
- hebrev()
- hebrevc()
- hex2bin()
- htmlentities()
- htmlspecialchars()
- htmlspecialchars_decode()
- html_entity_decode()
- implode()
- join()
- lcfirst()
- levenshtein()
- localeconv()
- ltrim()
- md5()
- md5_file()
- metaphone()
- money_format()
- nl2br()
- nl_langinfo()
- number_format()
- ord()
- parse_str()
- printf
- quoted_printable_decode()
- quoted_printable_encode()
- quotemeta()
- rtrim()
- setlocale()
- sha1()
- sha1_file()
- similar_text()
- soundex()
- sprintf()
- sscanf()
- strcasecmp()
- strchr()
- strcmp()
- strcoll()
- strcspn()
- stripcslashes()
- stripos()
- stripslashes()
- strip_tags()
- stristr()
- strlen()
- strnatcasecmp()
- strnatcmp()
- strncasecmp()
- strncmp()
- strpbrk()
- strpos()
- strrchr()
- strrev()
- strripos()
- strrpos()
- strspn()
- strstr()
- strtok()
- strtolower()
- strtoupper()
- strtr()
- str_getcsv()
- str_ireplace()
- str_pad()
- str_repeat()
- str_replace()
- str_rot13()
- str_shuffle()
- str_split()
- str_word_count()
- substr()
- substr_compare()
- substr_count()
- substr_replace()
- trim()
- ucfirst()
- ucwords()
- vfprintf()
- vprintf()
- vsprintf()
- wordwrap()
-
Array
- array()
- array_change_key_case()
- array_chunk()
- array_column()
- array_combine()
- array_count_values()
- array_diff()
- array_diff_assoc()
- array_diff_key()
- array_diff_uassoc()
- array_diff_ukey()
- array_fill()
- array_fill_keys()
- array_filter()
- array_flip()
- array_intersect()
- array_intersect_assoc()
- array_intersect_key()
- array_intersect_uassoc()
- array_intersect_ukey()
- array_keys()
- array_key_exists()
- array_key_first()
- array_key_last()
- array_map()
- array_merge()
- array_merge_recursive()
- array_multisort()
- array_pad()
- array_pop()
- array_product()
- array_push()
- array_rand()
- array_reduce()
- array_replace()
- array_replace_recursive()
- array_reverse()
- array_search()
- array_shift()
- array_slice()
- array_splice()
- array_sum()
- array_udiff()
- array_udiff_assoc()
- array_udiff_uassoc()
- array_uintersect()
- array_uintersect_assoc()
- array_uintersect_uassoc()
- array_unique()
- array_unshift()
- array_values()
- array_walk()
- array_walk_recursive()
- arsort()
- asort()
- compact()
- count()
- current()
- each()
- end()
- extract()
- in_array()
- key()
- key_exists()
- krsort()
- ksort()
- list()
- natcasesort()
- natsort()
- next()
- pos()
- prev()
- range()
- reset()
- rsort()
- shuffle()
- sizeof()
- sort()
- uasort()
- uksort()
- usort()
-
File
- basename()
- chgrp()
- chmod()
- chown()
- clearstatcache()
- copy()
- dirname()
- diskfreespace()
- disk_free_space()
- disk_total_space()
- fclose()
- feof()
- fflush()
- fgetc()
- fgetcsv()
- fgets()
- fgetss()
- file()
- fileatime()
- filectime()
- filegroup()
- fileinode()
- filemtime()
- fileowner()
- fileperms()
- filesize()
- filetype()
- file_exists()
- file_get_contents()
- file_put_contents()
- flock()
- fnmatch()
- fopen()
- fpassthru()
- fputcsv()
- fputs()
- fread()
- fscanf()
- fseek()
- fstat()
- ftell()
- ftruncate()
- fwrite()
- glob()
- is_dir()
- is_executable()
- is_file()
- is_link()
- is_readable()
- is_uploaded_file()
- is_writable()
- is_writeable()
- lchgrp()
- lchown()
- link()
- linkinfo()
- lstat()
- mkdir()
- move_uploaded_file()
- parse_ini_file()
- parse_ini_string()
- pathinfo()
- pclose()
- popen()
- readfile()
- readlink()
- realpath()
- realpath_cache_get()
- realpath_cache_size()
- rename()
- rewind()
- rmdir()
- set_file_buffer()
- stat()
- symlink()
- tempnam()
- tmpfile()
- touch()
- umask()
- unlink()
-
Datetime
- checkdate()
- date()
- date_add()
- date_create()
- date_create_from_format()
- date_date_set()
- date_default_timezone_get()
- date_default_timezone_set()
- date_diff()
- date_format()
- date_get_last_errors()
- date_interval_create_from_date
- date_interval_format()
- date_isodate_set()
- date_modify()
- date_offset_get()
- date_parse()
- date_parse_from_format()
- date_sub()
- date_sunrise()
- date_sunset()
- date_sun_info()
- date_timestamp_get()
- date_timestamp_set()
- date_timezone_get()
- date_timezone_set()
- date_time_set()
- getdate()
- gettimeofday()
- gmdate()
- gmmktime()
- gmstrftime()
- idate()
- localtime()
- microtime()
- mktime()
- strftime()
- strptime()
- strtotime()
- time()
- timezone_abbreviations_list()
- timezone_identifiers_list()
- timezone_location_get()
- timezone_name_from_abbr()
- timezone_name_get()
- timezone_offset_get()
- timezone_open()
- timezone_transitions_get()
- timezone_version_get()
-
Filter
-
HTTP
-
cURL
- curl_close()
- curl_copy_handle()
- curl_errno()
- curl_error()
- curl_escape()
- curl_exec()
- curl_file_create()
- curl_getinfo()
- curl_init()
- curl_multi_add_handle()
- curl_multi_close()
- curl_multi_errno()
- curl_multi_exec()
- curl_multi_getcontent()
- curl_multi_info_read()
- curl_multi_init()
- curl_multi_remove_handle()
- curl_multi_select()
- curl_multi_setopt()
- curl_multi_strerror()
- curl_pause()
- curl_reset()
- curl_setopt()
- curl_setopt_array()
- curl_share_close()
- curl_share_errno()
- curl_share_init()
- curl_share_setopt()
- curl_share_strerror()
- curl_strerror()
- curl_unescape()
- curl_version()
-
PDO
-
PDOStatement
日期函数
本章节列出截至PHP 7.3.6
所有的日期/时间函数以供参考。
下表以相关性排序。
函数名 | 描述 |
---|---|
date_default_timezone_get() | 获取 PHP 脚本中日期时间函数所使用的默认时区 |
date_default_timezone_set() | 设置脚本中日期时间函数所使用的默认时区 |
date_create() | DateTime 类构造函数DateTime::__construct 的别名,根据指定时间,创建一个DateTime 对象 |
date_create_from_format() | 根据给定的格式解析指定日期时间字符串为DateTime 对象 |
date() | 格式化一个本地时间或日期。返回格式化后的日期时间字符串 |
getdate() | 获取指定时间戳的详细信息。返回一个包含日期时间详细信息的关联数组 |
date_date_set() | DateTime 对象setDate() 方法的别名,设置DateTime 对象的日期 |
date_time_set() | DateTime 对象setTime() 方法的别名,设置DateTime 对象的时间 |
date_format() | DateTime 对象format() 方法的别名,格式化一个DateTime 对象 |
gmdate() | 与date() 函数类似,格式化一个日期时间 |
gmstrftime() | 与函数strftime() 类似,根据区域设置格式化格林威治标准时间 |
idate() | 接受一个格式化字符来将本地日期时间格式化为一个整数 |
strftime() | 根据本地区域设置(setlocale() 函数)的时区格式化本地日期/时间 |
date_diff() | 对象DateTime 的方法diff() 的别名。返回两个DateTime 对象之间的时间间隔信息 |
date_interval_format() | DateTime 对象的函数format() 的别名,格式化时间间隔 |
date_parse() | 解析一个日期时间字符串,返回带有详细时间日期信息的关联数组 |
date_parse_from_format() | 将一个时间日期字符串格式化后获取其详细信息 |
date_add() | 对一个DateTime 对象增加一定量的年、月、日、时、分、秒等时间间隔 |
date_sub() | 与函数date_add() 相反,对指定DateTime 对象减少一定量的年、月、日、时、分、秒等时间间隔 |
date_interval_create_from_date_string() | 从一个时间字符串中创建一个时间间隔对象 |
strptime() | 解析使用strftime() 函数生成的日期时间,返回一个时间信息数组 |
date_isodate_set() | 以ISO 8601规范的格式(以周和日作为日期参考, 而不是月和日)设置日期 |
date_modify() | 修改DateTime 对象的值 |
checkdate() | 验证一个格里高利历(俗称公历)日期是否合法 |
date_get_last_errors() | 获取解析日期时间字符串时发生的警告和错误信息数组 |
date_offset_get() | 返回指定时区相对于格林威治标准时区的以秒计的偏移量 |
date_sunrise() | 返回指定日期和地点的日出时间 |
date_sunset() | 返回指定日期和地点的日落时间 |
date_sun_info() | 返回指定时间地点的日出、日落、民用晨昏蒙影、航海晨昏蒙影和天文晨昏蒙影时间的关联数组 |
strtotime() | 将一个描述日期时间的字符串解析为 Unix 时间戳 |
mktime() | 返回指定的本地时间的 UNIX 时间戳表示 |
gmmktime() | 返回指定的格林威治标准时间(GMT)的UNIX时间戳表示 |
localtime() | 获取指定时间戳的本地日期时间信息 |
gettimeofday() | 获取当前时间的信息 |
microtime() | 返回当前时间的 Unix 时间戳(当前时间离 UNIX 纪元 1970 年 1 月 1 日 00:00:00 的秒数)和微秒数 |
time() | 返回当前时间的 Unix 时间戳(当前时间距离 UNIX 纪元1970年1月1日00:00:00的秒数) |
date_timestamp_get() | 获取指定时间对象的 UNIX 时间戳 |
date_timestamp_set() | 以 UNIX 时间戳的形式设置日期时间对象 |
date_timezone_get() | 获取给定日期时间对象的时区 |
date_timezone_set() | 设置DateTime 对象的时区 |
timezone_abbreviations_list() | 返回一个包含夏令时(dst)、时差和时区信息的关联数组 |
timezone_identifiers_list() | 返回所有时区库中包含的时区 |
timezone_location_get() | 获取时区对象的定位信息,其中包括国家代码、经纬度及时区说明 |
timezone_name_from_abbr() | 根据时区缩写名获取时区全名 |
timezone_name_get() | 获取时区对应的英文名称 |
timezone_offset_get() | 获取时区对象相对于格林威治标准时间(GMT)的以秒计的时差 |
timezone_open() | 创建一个新的DateTimeZone 对象 |
timezone_transitions_get() | 获取时区对象在两个时间之间进行过的时区更新过渡史,包括当时的时间戳、GMT 标准时、是否夏令时和更新的时区缩写 |
timezone_version_get() | 获取时区库的版本号 |
本参考手册的格式说明:
- 函数名
- 定义
- 语法
- 函数名
- 参数列表:参数列表中,变量名前是该变量的数据类型,其中特殊的
mixed
表示有多种可能的数据类型;使用方括号包裹的参数表示可选 - 返回类型:冒号后面是函数的标准返回类型
- 参数说明
- 示例
- 延展阅读
- 与当前函数具有相关性、相似性的函数
