[ PHP ] – 字串前方補零 2015 / 10 / 7 jeff 0 字串前方補零 $str='1'; echo str_pad($str,3,'0',STR_PAD_LEFT); //顯示結果 0001