The next paragraph is to determine if there is an AJAX request
But it's really hard to understand
Can you comment
Determine if there is an AJAX request $act =!empty ($_get[' act ')? $_get[' act ': '; if ($act = = ' Cat_rec ') { $rec _array = Array (1 = ' best ', 2 = ' new ', 3 = ' hot '); $rec _type =!empty ($_request[' Rec_type ')? Intval ($_request[' Rec_type '): ' 1 '; $cat _id =!empty ($_request[' cid ")? Intval ($_request[' CID '): ' 0 '; Include_once (' includes/cls_json.php '); $json = new json; $result = Array (' ERROR ' = 0, ' content ' = ', ' type ' = ' = ' $rec _type, ' cat_id ' + $cat _id); $children = Get_children ($cat _id); $smarty->assign ($rec _array[$rec _type]. ' _goods ', get_category_recommend_goods ($rec _array[$rec _type], $children)); Recommended Products $smarty->assign (' cat_rec_sign ', 1); $result [' content '] = $smarty->fetch (' Library/recommend_ '. $rec _array[$rec _type]. '. LBi '); Die ($json->encode ($result));}
Reply to discussion (solution)
Strictly speaking, this decision is to detect whether a GET request is being requested. is to get the get parameters and then judge what is not understood.
I don't know where you are, or you're not sure. This is a simple HTTP GET access output corresponding data based on the information obtained.
To determine if there is a GET request, and get the act value in the request parameter, it is not always possible for the AJAX call to be a normal browser call $act =!empty ($_get[' act '])? $_get[' act ']: ";// If the GET request parameter Act is CAT_REC, execute the IF code, if not equal, omit if ($act = = ' Cat_rec ') { $rec _array = Array (1 = ' best ', 2 = ' new ', 3 =& Gt ' hot '); $rec _type =!empty ($_request[' Rec_type ')? Intval ($_request[' Rec_type '): ' 1 '; $cat _id =!empty ($_request[' cid ")? Intval ($_request[' CID '): ' 0 '; Include_once (' includes/cls_json.php '); $json = new json; $result = Array (' ERROR ' = 0, ' content ' = ', ' type ' = ' = ' $rec _type, ' cat_id ' + $cat _id); $children = Get_children ($cat _id); $smarty->assign ($rec _array[$rec _type]. ' _goods ', get_category_recommend_goods ($rec _array[$rec _type], $children)); Recommended Products $smarty->assign (' cat_rec_sign ', 1); $result [' content '] = $smarty->fetch (' Library/recommend_ '. $rec _array[$rec _type]. '. LBi '); Die ($json->encode ($result));}
You hurt my heart ah, in fact, I understand, but, you are wrong, dare me to say the answer, probably a lot of people will say, this still use to say, certainly ha, this is human! So I won't tell you the answer.