Requirement: I want to integrate my blog with the Typecho backend and create a functionality for online status updates. I will input the content in Typecho and then call an API to display the status updates on my blog. It may sound a bit complicated, but I think it's worth trying.
By default, the data exported from Typecho is in timestamp format, which makes it inconvenient for frontend calls. Therefore, I choose to convert it directly in the SQL query. "created" is a parameter in the table.
// Conversion statement for time
FROM_UNIXTIME(created)
// Database query statement
$sql = "select FROM_UNIXTIME(created),text from ... order by created desc";
The exported data looks like this.
So, I use the "as" parameter to customize the previous statement.
$sql = "select FROM_UNIXTIME(created) as created,text from ... order by created desc";
The successful export makes the subsequent calls much simpler.
Thanks to 梦繁星 for the guidance.