First, send an ajax request to getPics. The code length is as follows: {code...} And then getPics. php is as long as this & amp; lt ;? Php {code ...}? & Amp; gt; I can correctly return the data obtained from www.wookmark.com during a local test, but when I put the code on github, I will return...
-
First, send an ajax request to getPics. The code length is as follows:
function getList(){ ajax('get', 'getPics.php', 'cPage=' + iPage, function(data){ var data=JSON.parse(data); if(!data.length){ return; } for(i=0;i
-
Then, the length of getPics. php is like this.
header('Content-type:text/html; charset="utf-8"'); $cpage = isset($_GET['cpage']) ? $_GET['cpage'] : 1; $url = 'http://www.wookmark.com/api/json/popular?page=' . $cpage; $content = file_get_contents($url); $content = iconv('gbk', 'utf-8', $content); echo $content;
?>
During the local test, I was able to correctly return the data obtained from www.wookmark.com, but when I put the code on github, the returned data became the string form of the PHP file content.
What's the problem?
Reply content:
-
First, send an ajax request to getPics. The code length is as follows:
function getList(){ ajax('get', 'getPics.php', 'cPage=' + iPage, function(data){ var data=JSON.parse(data); if(!data.length){ return; } for(i=0;i
-
Then, the length of getPics. php is like this.
header('Content-type:text/html; charset="utf-8"'); $cpage = isset($_GET['cpage']) ? $_GET['cpage'] : 1; $url = 'http://www.wookmark.com/api/json/popular?page=' . $cpage; $content = file_get_contents($url); $content = iconv('gbk', 'utf-8', $content); echo $content;
?>
During the local test, I was able to correctly return the data obtained from www.wookmark.com, but when I put the code on github, the returned data became the string form of the PHP file content.
What's the problem?
Will github help you parse and run php?
Github only stores code for you, but does not execute specific code.
Github page does not support PHP file running. You have to use your own server.
How can I answer this question .?
This is a great question.
Github is where code is hosted and does not provide running services. You need to put it in your php environment.