高級篇中將涉及數據庫的使用以及Cookie和Session會話,提升PHP的開發效率和運行效率php
PHP程序員須要掌握的MySQL操做html
鏈接MySQL DB:mysql
數據定義語言(DDL)linux
CREATE DATABASE [IF NO EXISTS] DatabaseName
CREATE TABLE [IF NOT EXISTS] TableName ( colname1 type [property] [index], colname2 type [property] [index], ... )[tableType] [tableCharSet];
※任何數據類型以字符串的形式存入,均可以自動轉換類型程序員
※將時間保存爲php時間戳,方便運算web
數據字段屬性算法
索引sql
數據表類型及存儲位置數據庫
功能 | MyISAM | InnoDB |
事務處理 | 不支持 | 支持 |
數據行鎖定 | 不支持 | 支持 |
外鍵約束 | 不支持 | 支持 |
表空間佔用 | 相對較小 | 較大 |
全文索引 | 支持 | 不支持 |
MySQL默認字符集數組
數據操做語言(DML)
數據查詢語言(DQL)
數據控制語言(DCL)
MySQL內置函數
strcmp(s1,s2):若是S1比S2小,返回-1;若是S1比S2大則返回1;若是相等則返回0(比較的是ASCII碼)
PHP操做數據庫
mysqli操做數據庫
PDO
mamcache/memcached
基於libevent事件,因此必須先安裝libevent庫
Command | Description | Example |
---|---|---|
get | Reads a value | get mykey |
set | Set a key unconditionally | set mykey 0 60 5 |
add | Add a new key | add newkey 0 60 5 |
replace | Overwrite existing key | replace key 0 60 5 |
append | Append data to existing key | append key 0 60 15 |
prepend | Prepend data to existing key | prepend key 0 60 15 |
incr | Increments numerical key value by given number | incr mykey 2 |
decr | Decrements numerical key value by given number | decr mykey 5 |
delete | Deletes an existing key | delete mykey |
flush_all | Invalidate specific items immediately | flush_all |
Invalidate all items in n seconds | flush_all 900 | |
stats | Prints general statistics | stats |
Prints memory statistics | stats slabs | |
Prints memory statistics | stats malloc | |
Print higher level allocation statistics | stats items | |
stats detail | ||
stats sizes | ||
Resets statistics | stats reset | |
version | Prints server version. | version |
verbosity | Increases log level | verbosity |
quit | Terminate telnet session | quit |
PHP中使用memcache
1 <?php 2 $memcache = new Memcache; 3 $memcache->connect("localhost",11211) or die("could not connect");
會話控制:面向鏈接的可靠的鏈接方式,經過會話控制,判斷用戶的登陸行爲
至此,PHP的基礎學習算是完成了,須要多作多學,方能提升!