PHP常用函數對象_PHP教程

來源:互聯網
上載者:User
==========字元處理函數=============
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)
PRECRegex
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統計屬性

http://www.bkjia.com/PHPjc/478744.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/478744.htmlTechArticle==========字元處理函數============= SQL語句保留字元轉義 long get_magic_quotes_gpc(void) string addslashes ( string str ) string stripslashes(string str) 字元的ASCI...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.