1.json_encode和json_decode
<?php $json = '{"a":1,"b":2,"c":3,"d":4,"e":5}'; var_dump(json_decode($json)); var_dump(json_decode($json, true)); ?>
object(stdClass)#1 (5) { ["a"] => int(1) ["b"] => int(2) ["c"] => int(3) ["d"] => int(4) ["e"] => int(5) } array(5) { ["a"] => int(1) ["b"] => int(2) ["c"] => int(3) ["d"] => int(4) ["e"] => int(5) }
2.base64_decode和base64_encode
<?php $str = 'VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw=='; echo base64_decode($str); ?> 此示例將顯示: This is an encoded string[1]
1、如果能將類的方法定義成static,就儘量定義成static,它的速度會提升將近4倍 2、row['id']的速度是$row[id]的7倍 3、echo 比 print 快,並且使用 echo 的多重參數(譯註:指用逗號而不是
以前沒有用SMARTY的時候要實現表格顏色的交替顯示,會用JQUERY來做,但現在的話用了SMARTY,要實現這個樣式就很簡單了,SMARTY提供了一個函數:cycle .以下是實例代碼: 最後實現的效果如下: test.php>
<?php /** * Created by PhpStorm. * User: 吳釗新 * Date: 2019/12/14 * Time: 12:58 */ header("Content-type: text/html;