You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
907 B
PHP
28 lines
907 B
PHP
<?php
|
|
|
|
include('config.inc.php');
|
|
|
|
$db = new PDO('mysql:host=' . $config['host'] . ';dbname=' . $config['database'], $config['dbuser'], $config['password'], [
|
|
\PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_ASSOC,
|
|
\PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8mb4'"
|
|
]);
|
|
|
|
$result = array('res' => 0, 'data' => array());
|
|
|
|
$sql = "SELECT `id`,`title`,file_name AS fileName,`path`,file_size AS fileSize,`md5`,`type`,create_time AS createTime,update_time AS updateTime";
|
|
$sql .= " FROM mntn_upgrades WHERE `status`=1 OrDER BY `id` DESC";
|
|
$stmt = $db->prepare($sql);
|
|
$stmt->execute();
|
|
|
|
$result['data'] = $stmt->fetchAll();
|
|
$stmt = null;
|
|
foreach ($result['data'] as &$item)
|
|
{
|
|
$item['path'] = $config['upgrade_root'] . $item['path'];
|
|
}
|
|
unset($item);
|
|
|
|
header ('Access-Control-Allow-Origin: *');
|
|
header ('Content-type: application/json; charset=utf-8');
|
|
echo json_encode($result, JSON_UNESCAPED_UNICODE);
|