define(‘_test’,0);
echo (_test==’ABC’);
// 居然是1
困擾了我好久..
這不知道是Bug還是怎樣..
常數設為0居然等於任何字串..
知道原因的高手可否告訴小弟..
以下是我目前找出來的解法:
解法1:
define(‘_test’,”);
echo (_test==’ABC’);
// 把常數設為字串,這樣就不相等了
解法2:
define(‘_test’,0);
echo (_test===’ABC’);
[……]
define(‘_test’,0);
echo (_test==’ABC’);
// 居然是1
困擾了我好久..
這不知道是Bug還是怎樣..
常數設為0居然等於任何字串..
知道原因的高手可否告訴小弟..
以下是我目前找出來的解法:
解法1:
define(‘_test’,”);
echo (_test==’ABC’);
// 把常數設為字串,這樣就不相等了
解法2:
define(‘_test’,0);
echo (_test===’ABC’);
[……]
function updateURLParameter(url, param, paramVal)
{
var TheAnchor = null;
var newAdditionalURL = “”;
var tempArray = url.split(“?”);
var baseURL = tempArray[0];
var additionalURL = tempArray[1];
var temp = “”;
if (additionalURL)
{
var tmpAnchor = additionalURL.split(“#”);
var TheParams = tmpAnchor[0];
TheAnchor = tmpAnchor[1];
if(TheAnchor)
additionalURL = TheParams;
tempArray = additionalURL.split(“&”);
for (i=0; i<tempArray.length; i++)
{
if(tempArray[i].split(‘=’)[0] != param)
{
newAdditionalURL += temp + tempArray[i];
temp = “&”;
}
}
}
else
{
var tmpAnchor = baseURL.split(“#”);
var TheParams = tmpAnchor[0];
TheAnchor = tmpAnchor[1];
if(TheParams)
baseURL = TheParams;
}
if(TheAnchor)
paramVal += “#” + TheAnchor;
var rows_txt = temp + “” + param + “=” + paramVal;
return baseURL + “?” + newAdditionalURL + rows_txt;
}
//var url = ‘http://aaa.bb.cc.tw/index.php#’;
//var test = updateURLParameter(url, ‘aa’, ‘aaval’);
//var test2 = updateURLParameter(test, ‘bb’, ‘bbval’);
//var test3 = updateURLParameter(test2, ‘cc’, ‘ccval’);
//var test4 = updateURLParameter(test3, ‘bb’, ‘cheng_val’);
//alert(test4);[……]
location.href : http://functionlab.org:80/tools/tcpproxy.php?user=FUNction#showscript
location.protocol : http
location.hostname : functionlab.org
location.host : functionlab.org:80
location.port : 80
location.pathname : /tools/tcpproxy.php
location.search : ?user=FUNction
location.hash : #showscript[……]
獲取一組radio被選中項的值:var item = $(‘input[name=items][checked]’).val();
獲取select被選中項的文本:var item = $(“select[@name=items] option[@selected]”).text();
獲取select被選中項的文本 :var item = $(“select[name=items] option[selected]”).text(); 或$(“select[name=items]”).find(“option:selected”).text();
select下拉清單value = ‘val’的元素為當前選中項:$(“select[name=items] option[value=’val’]”).attr(“selected”,”selected”);
radio單選組的第二個元素為當前選中項 :$(‘input[@name=items]’).get(1).checked = true; 或$(‘input[name=items]’).attr(“checked”, ‘1′);
[……]