본문 바로가기

Programming/PHP

(14)
PHP Performance (튜닝의 지름길) 18. Performance Performance, particularly on busy sites, can be critical - after all, if you can speed up your code by 10%, that decreases your hardware load by 10%, saving you the need to upgrade. There are a number of ways you can improve the performance of your scripts, and we will be covering as many as have space for. We will also be dispelling various myths about optimisation, and hopefull..
[PHP] 파일 읽고 쓰기 fOpen fWrite * fOpen $filename='test.txt'; $dataFile = fopen( $filename, "r" ); if ( $dataFile ) { while (!feof($dataFile)) { $buffer = fgets($dataFile, 4096); } } fclose($dataFile); * fWrite filename='test.txt'; $dataFile = fopen( $filename, "w" ); if ( $dataFile ) { fwrite($dataFile ,"1234567890\n"); } fclose($dataFile);
[PHP] 간단한 스위치(switch) 구문 switch ($code): case reg: include 'member_01.html';break; default: include 'member.html'; endswitch;
[PHP] 문자 장난 $db_key_ = explode ("|", $db_key);구분자로 분리 (사실 무자게 시스템 영향을 타는 구문)
[PHP] 직관적인 MySQL connect 및 Query $dbconn=mysql_connect("localhost","user","userpw"); $status=mysql_select_db("db",$dbconn); $q="select * from download_server"; $re=mysql_query($q,$dbconn); $total=mysql_num_rows($re); for($k=1;$k
[PHP] 날자관련 (date,mktime) 금일 날자 (서버시간 기준) $today_time = time(); 오늘 $today_time = date('Y-m-d H:i:s'); $today_time = mktime (date("H"),date("i"),date("s"), date("m"), date("d"), date("Y")); mktime -> date $test=date("Y-m-d H:i:s",$test2[0]); data -> mktime function gettime_of_datetime($date,$debug=null) { eregi("(.+)-(.+)-(.+) (.+):(.+):(.+)",$date,$temp); // $temp=preg_split("/[-,:, ]/", $date); // 이게 더 보기 좋음 $gettime = ..