我嘗試使用此:PHP 7連接到mysqli的
$localhost = 'http://127.0.0.1:8080/';
$username = 'root';
$password = 'mypass';
$database = 'test';
$mysqli = new mysqli($localhost, $username, $password, $database);
我收到此錯誤:
Warning: mysqli::__construct(): php_network_getaddresses: getaddrinfo failed: No such host is known.
當我瀏覽到:http://localhost:8080/phpmyadmin/和使用 '根' & '將mypass' 這是連接,我有一個名爲'測試'的表。
我在做什麼錯了?
你嘗試:'$本地主機= 'localhost' 的;' – C2486
誰反對投票所有其他的答案?他們是正確的。只要檢查回答時間,看看他們幾乎是在同一時間寫的。 –