This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$target_ary = array(); | |
$eval_ary=array(); | |
$result_ary = array(); | |
foreach($target_ary as $key => $value){ | |
if(!in_array($value, $eval_ary)){ | |
$eval_ary[] = $value; | |
$result_ary[] = $value; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$date = new DateTime('NOW'); | |
$time_str = preg_replace("/\+/"," +",preg_replace("/T/"," ", $date->format(DATE_ISO8601))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$date_utc = new DateTime(); | |
$date_utc->setTimezone( new DateTimezone('UTC') ); | |
echo preg_replace("/\+/"," +",preg_replace("/T/"," ",$date_utc->format(DATE_ISO8601))).PHP_EOL; | |
$date = new DateTime(); | |
$date->setTimezone( new DateTimezone('Asia/Tokyo') ); | |
echo preg_replace("/\+/"," +",preg_replace("/T/"," ",$date->format(DATE_ISO8601))).PHP_EOL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class RandStr{ | |
private $small = 'abcdefghjiklmnopqrstuvwxyz'; | |
private $large = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; | |
private $num = '0123456789'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
exec("rm *.csv"); | |
exec("rm *.zip"); | |
$datas = array(); | |
$datas[] = "hoge,hoge,hoge,hoge\nhoge,hoge,hoge"; | |
$datas[] = "fizz,buzz,fizzbuzz\nfizz,buzz,fizzbuzz"; | |
$csv_list = array(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define('SQL_SAVE', 'sql_save'); | |
$save_log_file = date('Ymd').'_sql_save'; | |
CakeLog::config('sql_save', array( | |
'engine' => 'FileLog', | |
'types' => array('sql_save'), | |
'file' => $save_log_file, | |
)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function afterSave(){ | |
$data = $this->getDataSource(); | |
$all_log = $data->getLog(); | |
$last_log = end($all_log['log']); | |
$last_query = $last_log['query']; | |
$this->log($last_log['query'],SQL_SAVE); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
listen 80; | |
server_name ;#ドメイン名 | |
root /path/to/wordpress; #ワードプレスのパス | |
index index.php; | |
error_log /path/to/log/error.log;#エラーログへのパス | |
access_log /path/to/log/sccess.log;#アクセスログへのパス | |
try_files $uri $uri/ /index.php?q=$uri&$args; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function perse_referrer_query(){ | |
if(isset($_SERVER['HTTP_REFERER'])){ | |
$referrer = parse_url(urldecode($_SERVER['HTTP_REFERER'])); | |
$tmp_queries = explode('&',$referrer['query']); | |
$queries = array(); | |
foreach($tmp_queries as $query){ | |
$tmp = explode('=',$query); | |
$queries[$tmp[0]] = $tmp[1]; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function space_compress($str){ | |
return preg_replace('/\s+/', ' ', preg_replace('/ /', ' ',$str)); | |
} | |
OlderNewer