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 | |
$it = new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS); | |
$files = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST); | |
foreach($files as $file) { | |
if ($file->isDir()){ | |
rmdir($file->getRealPath()); | |
} else { | |
unlink($file->getRealPath()); | |
} | |
} |
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
<script src="https://maps.googleapis.com/maps/api/js?v=3&key=[key]&sensor=false"></script> | |
<script> | |
$(function () { | |
var geocoder = new google.maps.Geocoder; | |
$('#trans').on('click', function () { | |
var address = $('input[name=address]').val(); | |
geocoder.geocode({'address': address}, function (results, status) { | |
if (status === google.maps.GeocoderStatus.OK) { | |
var api = results[0].geometry.location; |
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
至少八個字符,至少一個字母和一個數字: | |
"^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$" | |
至少八個字符,至少一個字母,一個數字和一個特殊字符: | |
"^(?=.*[A-Za-z])(?=.*\d)(?=.*[@$!%*#?&])[A-Za-z\d@$!%*#?&]{8,}$" | |
至少八個字符,至少一個大寫字母,一個小寫字母和一個數字: | |
"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$" | |
至少八個字符,至少一個大寫字母,一個小寫字母,一個數字和一個特殊字符: |
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
/** | |
* @param $hexColor | |
* @return string | |
*/ | |
function getContrastColor($hexColor) | |
{ | |
$R1 = hexdec(substr($hexColor, 1, 2)); | |
$G1 = hexdec(substr($hexColor, 3, 2)); | |
$B1 = hexdec(substr($hexColor, 5, 2)); |
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 ip_in_range($ip, $range) | |
{ | |
if (strpos($range, '/') == false) { | |
return ($ip == $range); | |
} | |
list($range, $netmask) = explode('/', $range, 2); | |
$range_decimal = ip2long($range); | |
$ip_decimal = ip2long($ip); | |
$wildcard_decimal = pow(2, (32 - $netmask)) - 1; | |
$netmask_decimal = ~$wildcard_decimal; |