PHP gets the data and sends it to the specified tag.
小Q
小Q 2017-10-19 22:34:08
0
1
1087

function success_msg($data=array()){
$arr ​​= $data;
}

The obtained values ​​are as follows.
[result_code] => SUCCESS [return_code] => SUCCESS [return_msg] => OK

Please tell me how to get the data here and send it to the specified label.

For example, it is displayed like this on the page

Result code: SUCCESS

Return code: SUCCESS

Return information: OK

Thank you.

小Q
小Q

reply all(1)
phpcn_u2434

First of all, your function must have a return value to print the array inside. Add return $arr;

in the function so that you can directly var_dump(success_msg()); and you can print out the array.

The tag you are talking about refers to the html tag? To output the php code in html, write it like this <?php echo 'result code'.success_msg()['result_code'];?>

Also confirm whether your array is written correctly

  • reply Thank you for your answer, it has been solved.
    小Q author 2017-10-22 14:58:08
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!