php

I often got confused about JSON and JSON string. JSON is the code you write in your javascript script to represent an object, so the code is called JavaScript Object […]

I encountered a strange problem of php curl. I use curl to fetch a remote web page as follows: $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, “https://myprogrammingnotes.com”); curl_setopt($curl, CURLOPT_HEADER,1); curl_setopt($curl, CURLOPT_FRESH_CONNECT,1); curl_setopt($curl, […]

I love php array because the array’s key can not only be number but also be string. $arr=array(“a”,”b”,”c”); $arr=[“a”,”b”,”c”]; $arr=array(“k1″=>”a”,”k2″=>”b”,”k3″=>”c”); $arr=[“k1″=>”a”,”k2″=>”b”,”k3″=>”c”];   That makes it an association array or a […]

You must have seen url redirect. You click an html redirect link. The link does not take you to the page it points to, but redirects the url to another […]

I set a cookie as follows: setcookie(“mycookie”, “1”, time()+8); The cookie “mycookie” is set to “1” and will expire in 8 seconds. The http Set-Cookie header received from the server […]