search

Home  >  Q&A  >  body text

PHP gets the data and sends it to the specified tag.

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小Q2638 days ago1121

reply all(1)I'll reply

  • 按键盘手指磨破皮

    按键盘手指磨破皮2017-10-20 17:33:59

    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
    1
  • 小Q

    Thank you for your answer, it has been solved.

    小Q · 2017-10-22 14:58:08
  • Cancelreply