Home php教程 php手册 PHP常用函数对象

PHP常用函数对象

Jun 13, 2016 am 10:42 AM
get long magic php quotes sql reserve function deal with character object Commonly used statement escape

==========字符处理函数=============
SQL语句保留字符转义
long get_magic_quotes_gpc(void)
string addslashes ( string str )
string stripslashes(string str)
字符的ASCII码
int ord(string string) 十进制
string chr(ascii) 十进制 八进制(0) 十六进制(0x)
string base_convert(string $number,int $frombase,int $tobase)
清理字符串空格
string trim(string,charlist) charlist,可选
string rtrim(string,charlist)
string ltrim(string,charlist)
改变字母大小写
string strtolower(string $str)
string strtoupper(string $str)
string ucfirst(string $str)
string ucwords(string $str)
截取字符串
array explode(separator,string,limit) limit,可选,返回的数组元素的最大数目
string substr(string,start,length)
int strlen(string)
string strstr(string,search) 大小写敏感
string stristr(string,search)
string str_repeat(string,repeat)
字符串查找
int strpos(string,find,start) start,可选
int substr_count(string,substring,start,length) start,length,可选
string str_replace(find,replace,string,count) count,可选。
string strrev(string $string) 字符翻转,限一个字节字符
html处理
string htmlspecialchars(string,quotestyle,character-set) quotestyle,character-set,可选。
htmlentities("

我爱你

",ENT_COMPAT,"GB2312")
string htmlspecialchars_decode(string,quotestyle,character-set)
string htmlentities(string,quotestyle,character-set)
string html_entity_decode(string,quotestyle,character-set)
string strip_tags(string $str[,string $allowable_tags])
日期时间[Y-m-d H:i:s]

-----------------------------------

php 设置时区
1.代片断声明
date_default_timezone_set (PRC);
2.php.ini定义
date.timezone = "PRC"

-----------------------------------
double time(void)
float microtime(get_as_float) get_as_float,可选
string date(format,timestamp) timestamp,可选
array getdate(timestamp)
double mktime(hour,minute,second,month,day,year,is_dst)
array gettimeofday(return_float) return_float,可选,返回一个秒与微秒等时间信息的数组
URL处理
array parse_url(string $url(,int $component = -1])
string urlencode(string $str)
string urldecode(string $str)
获取PHP环境扩展与启用函数库
array get_loaded_extensions([bool $zend_extensions = false])
array get_extension_funcs(string $module_name)
PREC正则表达式
int preg_match ( string $pattern , string $subject [, array &$matches [, int $flags = 0 [, int $offset = 0 ]]] )
int preg_match_all ( string pattern, string subject, array matches [, int flags] )
mixed preg_replace ( mixed pattern, mixed replacement, mixed subject [, int limit] )
mysqli相关类
--mysqli类 PHP 和 MySQL 数据库之间的连接
---构造函数
---mysqli(host,user,pass,db)
---方法
---set_charset(gbk)
---character_set_name()
---select_db(db)
---query(sql)
---prepare(sql) sql:insert into table values(?,?)
---close()
---属性
---affected_rows
---error


--mysqli result类
---方法
---fetch_array()
---close()
---属性
---num_rows


--mysqli stmt类
---方法
---bind_param(type,var...)
---execute()
---close()
---属性
---affected_rows
---error
---num_rows
---field_count select统计属性
 

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 AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

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)

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

CakePHP Date and Time CakePHP Date and Time Sep 10, 2024 pm 05:27 PM

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

CakePHP File upload CakePHP File upload Sep 10, 2024 pm 05:27 PM

To work on file upload we are going to use the form helper. Here, is an example for file upload.

CakePHP Working with Database CakePHP Working with Database Sep 10, 2024 pm 05:25 PM

Working with database in CakePHP is very easy. We will understand the CRUD (Create, Read, Update, Delete) operations in this chapter.

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

CakePHP Creating Validators CakePHP Creating Validators Sep 10, 2024 pm 05:26 PM

Validator can be created by adding the following two lines in the controller.

CakePHP Logging CakePHP Logging Sep 10, 2024 pm 05:26 PM

Logging in CakePHP is a very easy task. You just have to use one function. You can log errors, exceptions, user activities, action taken by users, for any background process like cronjob. Logging data in CakePHP is easy. The log() function is provide

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

See all articles