函数
字符串分割与连接函数:
代码: |
array explode(string delimiter, string data) |
使用字符串 dellimiter 把 data 分割成一个数组返回
类似函数:split()
代码: |
string implode(array data, string dellimiter) |
作用和explode()正好相反,把数组用dellimiter连接成一个长字符串
函数别名:join()
代码: |
array split(string pattern, string text[, integer limit]) |
使用匹配模式pattern的字符作为分隔符,把字符串text分割成数组
limit 可选参数,限制分割的段数
字符串编解码函数:
代码: |
string addslashes(string text) |
在字符串text中的特殊字符之前加“\”返回,特殊字符包括 ('), ("), (\)。
类似函数:quotemeta()
代码: |
string stripslashes(string text) |
和addslashes()函数正好相反,去掉反斜杠编码
代码: |
string quotemeta(string text) |
类似于addslashes(),区别在于它的特殊字符包括: . \ + * ? [ ] ^ ( ) $
代码: |
string escapeshellcmd(string command) |
在所有有可能在shell命令中引起麻烦的字符前加反斜杠。
用于exec(), system()等函数之前。
代码: |
string mysql_escape_string(string text) |
把一个SQL字符串转义,以安全用于mysql_query()
HTML 相关函数
代码: |
string htmlentities(string text) |
转换所有HTML实体
代码: |
string htmlspecialchars ( string string [, int quote_style [, string charset]]) |
转换特定字符为HTML实体
quote_style: (ENT_COMPAT|ENT_QUOTES)
quote_style默认值:ENT_COMPAT 转换&
当quote_style为:ENT_QUOTES时,除转换以上字符外还转换 " and '
代码: |
string trim(string text) |
去掉字符串text开始和结束处的空字符
代码: |
string ltrim(string text) |
去掉字符串text开始处的空字符
代码: |
string rtrim(string text) |
去掉字符串text结束处的空字符
代码: |
string chop(string text) |
函数rtrim()的别名

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Zend Studio 13.0.1
Powerful PHP integrated development environment

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),
