How can the data queried by php be returned to the front end?

clipboard.png
php code is as follows

Jun.27,2022

change header first

header('Content-Type: application/json');

then remove the last ? >

after the final json_encode, you can directly use echo or die to return the output.
it is recommended to define a uniform API return format and develop it as a method.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b30626-2b559.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b30626-2b559.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?