I tried to read a JSON file through jquery and put it in PHP for dynamic layout and output. Now I have a problem that I don't know how to save the parameter values in the JSON that the function reads to, and then read these values in PHP. I would like to have a friend who knows how to help (preferably with code).
First, the JSON file format is as follows:
[
{"Counter": "0", "ContentID": "5876", "Score": "1.20501602970259", "Presentationid": "3496", "Conferenceid" ":", "title": "Personalized Network updates:increasing social Interactions and contributions in social Networks", "Acmlink": "null", "DOI": "Http://www.springerlink.com/content/872x206h570ln625/fulltext.pdf", "ContentType": "Lo Ng Paper "," Contenttrack ":" 1 "," authors ": [{" Authorid ":" The "," name ":" Shl Omo Berkovsky "}, {" Authorid ":" 155 "," Name ":" Jill Freyne "}, {"Authorid": "2947", "name": "Gregory Smith"}], "tags": ["3545", "Contributi On "," evaluation "," motivation "," News Feed "," personalisation "," personalization "," Personalized News Feeds "," ranking " , "Recommender", "Recsys", "Shlomo Berkovsky", "SNA", "Social Network", "Social networks", "Social-network"], "methodid ": [0, 102, 101]},{" CoUnter ":" 1 "," ContentID ":" 5883 "," Score ":" 0.984497667264824 "," Presentationid ":" 3503 "," Conferenceid ":" 85 " , "title": "Users and noise:estimating the Magic Barrier of Recommender Systems", "Acmlink": "null", "DOI": "Htt P://www.springerlink.com/content/g70242127h5kj186/fulltext.pdf "," ContentType ":" Long Paper "," Contenttrac K ":" 1 "," authors ": [{" Authorid ":" 3120 "," name ":" Alan said "}
]
I use jquery to read the JSON file's code:
$ (function ()
{
$ ("#btn"). Click (Function ()
{
$.getjson ("Communityrecsys.json", function (data)
{
var $jsontip = $ ("#jsonTip");
var strhtml = "";//Storage variable
$jsontip. Empty ();//Clear Contents
$.each (Data,function (Infoindex,info)
{
strHTML + = "title:" +info["title"]+ "
";
strHTML + = "Authors:" +info["Authors"]+ "
";
strHTML + = "Types:" +info["type"]+ "
";
strHTML + = "Track:" +info["Contenttrack"]+ "
";
strHTML + = "doi:" +info["doi"]+ "
";
strHTML + = "
"
There are only a few values that need to be taken.
});
});
});
});
Then in PHP with this code test, the value can be displayed normally:
The description value has been read in normally.
Here is the code that I want to make the PHP layout. (Proceedings is the name of each module, which I would like to use to represent the JSON file's own set of variable names)
foreach ($proceedings as $method) {
".$method['title'].""; ?>
How can I be able to read the function of the JSON file with a variable $method save, so that all the parameters within the JSON I can use method. The method of XX is directly taken to the value. Thank you, great God!