在PHP中輸出 javascript 字串如輸出 alert();
換行要用\n
$str = “取回密碼信件已寄到 “.$mail.” 信箱中,\n請盡速以新密碼登入,並修改密碼。”;[……]
$str = ‘測試字串’;
$fp = fopen(‘ftp://username:[email protected]/test.txt’,’w’);
fwrite($fp, $str);
fclose($fp);[……]
$str = ‘測試字串’;
$fp = fopen(‘text.txt’,’w’);
fwrite($fp, $str);
fclose($fp);
fopen()參數說明
[……]
$(document).ready(function(e) {
$('#test').click(function(e){
alert('觸發綁定事件');
});
$('#test').trigger("click");
$('#test')[0].click;
});http://www.pureexample.com/tw/jquery/custom-event.html[……]
/**
* VECTOR COOL
* https://vector.cool
*/
//用curl傳post並取回傳值
//一定要傳絕對路徑
function curl_post($url,$post)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST,true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$result = curl_exec($ch);
curl_close ($ch);
return $result;
}/** * VECTOR COOL * https://vector.cool */ $url='http://tw.yahoo.com'; $post_value= array( 'name' => 'JACK', 'age' => '20', 'phone' => '0968123456', 'address' => '台灣' ); echo curl_post($url,$post_value);
[……]