This file contains hidden or 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 | |
$url_arr=Array('software'=>'software.sopili.net','dev'=>'dev.sopili.net'); | |
foreach($url_arr as $key=>$value){ | |
echo $key."<br>"; //重點是 key,有時候非常的需要key這個值,然後是字串型態 | |
} |
This file contains hidden or 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 | |
//宣告 | |
var url_arr={'software':'software.sopili.net','dev':'dev.sopili.net'}; | |
//讀取 | |
for(var key in url_arr){ | |
//這裡面的key值,就真的是字串了! | |
document.write(url_arr[key]+'<br>'); | |
} |
This file contains hidden or 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 | |
function mb_str_split($string,$string_length=1) { | |
if(mb_strlen($string)>$string_length || !$string_length) { | |
do { | |
$c = mb_strlen($string); | |
$parts[] = mb_substr($string,0,$string_length); | |
$string = mb_substr($string,$string_length); | |
}while(!empty($string)); | |
} else { |
This file contains hidden or 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
<input type='button' onclick="window.location.href='http://tools.sopili.net/';" value='執行' /> |
This file contains hidden or 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 style='display:none' href='http://tools.sopili.net/' id='exe'>&amp;nbsp;</a> | |
<input type='button' onclick="document.getElementById('exe').click();" value='執行' /> |
This file contains hidden or 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 type='text/javascript' src="http://yui.yahooapis.com/2.6.0/build/yahoo/yahoo-min.js" ></script> | |
<script type='text/javascript' src="http://yui.yahooapis.com/2.6.0/build/event/event-min.js" ></script> | |
<script type='text/javascript'> | |
YAHOO.util.Event.onDOMReady(function(){ | |
}); | |
</script> |
This file contains hidden or 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
<form accept-charset="Big5" method=post> | |
..... | |
</form> |
This file contains hidden or 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
<html> | |
<head> | |
<script type='text/javascript' src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> | |
<script> | |
$(document).ready(function(){ | |
var tpl_html=$('#tpl').html(); | |
$("#main").html(tpl_html); //copy html into new div | |
$("#tpl input[name='xxx']").val('hi'); //set value into input element | |
alert($("#tpl input[name='xxx']").val()); // input element is 'hi' | |
alert($("#tpl").html()); //print #main 's html, where is 'hi' ?? |
This file contains hidden or 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 | |
$counter_file='count.txt'; | |
$count=intval(file_get_contents($counter_file)); | |
$handle=fopen($counter_file,'w+'); | |
fwrite($handle,$count+1); | |
fclose($handle); |
This file contains hidden or 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 | |
$counter_file='count.txt'; | |
$counter_tmp='count.tmp'; | |
$handle=fopen($counter_tmp,'a+'); | |
fwrite($handle,'.'); | |
fclose($handle); | |
$count= intval(file_get_contents($counter_file))+filesize($counter_tmp); |