$conn->Connect( $dbhost, $dbuser, $dbpwd, $dbname); //Connect to the database
$conn->Query("Set Names 'gb2312'"); //Sourced from mysql_query("SET NAMES GBK");
date_default_timezone_set( PRC); //The solution for PHP to obtain the time difference of 8 hours, you can also modify the date.timezone in php.ini to PRC
?>
Copy the code
Homepage index.php:
require_once("const.php");
$sql1="select id,hits,title,add_date from oa_art order by id desc"; //SQL statement
$url = preg_replace(array("!(([& ]|^)(page)[=]?([^&]+)?)|((([&]){2,})|(^[&])|([&]$))!" ,),array(""),$_SERVER["QUERY_STRING"]); // Set the address and replace it with regular
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn