教您運用AES_ENCRYPT加密AES_DECRYPT讀取您MySql的資料PHP

討論區:

PHP 教您運用AES_ENCRYPT加密AES_DECRYPT讀取您MySql的資料

$key = 'sdeSdawedDSWa2343sfDe'; //自定
$phone = '097912345678';
$address = '美國紐約市';
 
//寫入資料庫
insert into dbName (sn,phone,address)values(0,AES_ENCRYPT('$phone','$key'),AES_ENCRYPT('$address','$key')
 
//搜尋取出資料
select AES_DECRYPT(phone,'$key') as phone,AES_DECRYPT(address,'$key') as address from dbName where sn='55' limit 1