Due to the requirements of the interface party, the data is processed in js, so the php program needs to retrieve the values from the database and assign them to the js array. I haven't found a good way yet, because the data encoding of PHP arrays is different from the encoding format of JS arrays and cannot be output directly.
After searching online, I found the solution:
The PHP function library provides functions for encoding/decoding JSON: json_encode() and json_decode(), which can easily pass arrays or objects to JavaScript. Note: The JSON extension is only bound to PHP 5.2 and above.
Write the following in php: