I have a page now. searchfangxiang.php defines a two-dimensional array:
Array ("FID" = "101", "Name" = "Automation Institute", "Professor" and "Professor Zhang"),
' fid102 ' =>array ("fid" = "102", "Name" = "Lab", "Professor" and "Professor Li"),
' fid103 ' =>array ("fid" = "103", "Name" and "Science Institute", "Professor" and "Professor Wang"););
?>
The page of this two-dimensional array is then referenced in my application page
echo " ";
?>
Now the App page has an ID how do I traverse this two-dimensional array, find the same set of FID in the two-dimensional array as the page ID, and then Label to output this group of information
Reply to discussion (solution)
The way you organize your data, you don't need to traverse
Just echo $fangxiang ["fid$id"] [' Name ']; Can
Go to JSON and put it on the app page, read with JS or jquery
The way you organize your data, you don't need to traverse
Just echo $fangxiang ["fid$id"] [' Name ']; Can
Yes, I think it's complicated.
The way you organize your data, you don't need to traverse
Just echo $fangxiang ["fid$id"] [' Name ']; Can
I'm too novice, I'm still in the loop.
If it's not organized like this,
$fangxiang = Array ( ' fid101 ' = = Array ("FID" = "101", "Name" = "Automation Institute", "Professor" and "Professor Zhang"), ' fid102 ' = = Array ("FID" = "102", "Name" = "Lab", "Professor" and "Professor Li"), ' fid103 ' = = Array ("FID" = " 103 "," Name "=" Science Institute "," Professor "and" Professor Wang ");
But it's organized like this.
$fangxiang = Array (0 = = Array ( "fid" = "101", "Name" = "Automation Institute", "Professor" and "Professor Zhang"), 1 = = Array ( "FID" and "102", "name" and "Lab", "Professor" and "Professor Li", 2 = = Array ("FID" = "103", "name" = "Science Institute", " Professor "" and "Professor Wang");
Then we need to traverse the
foreach ($fangxiang as $item) {
See the right data structure for a multiplier effect
If it's not organized like this,
$fangxiang = Array ( ' fid101 ' = = Array ("FID" = "101", "Name" = "Automation Institute", "Professor" and "Professor Zhang"), ' fid102 ' = = Array ("FID" = "102", "Name" = "Lab", "Professor" and "Professor Li"), ' fid103 ' = = Array ("FID" = " 103 "," Name "=" Science Institute "," Professor "and" Professor Wang ");
But it's organized like this.
$fangxiang = Array (0 = = Array ( "fid" = "101", "Name" = "Automation Institute", "Professor" and "Professor Zhang"), 1 = = Array ( "FID" and "102", "name" and "Lab", "Professor" and "Professor Li", 2 = = Array ("FID" = "103", "name" = "Science Institute", " Professor "" and "Professor Wang");
Then we need to traverse the
foreach ($fangxiang as $item) {
See the right data structure for a multiplier effect
Great God I have another question, I now want to do a search on the page function, how to write Fuzzy lookup Ah, such as I search "science", put the name of science two words
This group of information to find out, the search name is the same, PHP can do this
This effect should be done with JS
Array ("FID" = "101", "name" = "Automation Institute", "Professor" and "Professor Zhang"), ' fid102 ' =>array ("fid" = "102", "name "=" Lab "," Professor "and" Professor Li "), ' fid103 ' =>array (" fid "=" 103 "," Name "=" Science Institute "," Professor " "Professor Wang")); $id = 101;? >
". $fangxiang [' FID '. $id] [" Name "].";? >
Search for.
Array ("FID" = "101", "name" = "Automation Institute", "Professor" and "Professor Zhang"), ' fid102 ' = = Array ("FID" = "102", "name "+" laboratory "," Professor "and" Professor Li "), ' fid103 ' = = Array (" FID "=" 103 "," Name "=" Science Institute "," Professor "= "Professor Wang"); >
Search Key:
Type Name Professor