<?php date_default_timezone_set('Asia/Taipei'); require __DIR__ . '/bootstrap.php'; use Carbon\Carbon; carbon::setLocale('zh-tw'); // connect to dabase try { $dsn = 'mysql:host=' . DB_HOST . ';port=' . DB_PORT . ';dbname=' . DB_DATABASE . ';charset=' . DB_CHARSET; $pdo = new PDO($dsn, DB_USERNAME, DB_PASSWORD); } catch (PDOException $e) { echo "Error: " . $e->getMessage() . "<br/>"; die; } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content=""> <title>Laravel 道場訓練教材:運用 Carbon 顯示資料庫內文章時間</title> <!-- Bootstrap Core CSS --> <link href="css/bootstrap.min.css" rel="stylesheet">