對於實例考慮這個標準的數據庫連接php文件。如何隱藏顯示在HTML上的回顯結果?
db_conn.php
<?php
$servername = "localhost";
$username = "root";
$password = "Yash123";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>
如果連接成功也導致在該網站顯示。
我需要它做的事情不是顯示在html上,而是在文件中,因此我可以測試在PHP的CLI(命令行界面)中執行的文件。
我正在使用require_once();在索引文件中。
簡單要麼刪除'echo'部分或評論它 –
要隱藏「連接成功」的消息? –
取消註釋。或者使用php的'error_log('連接成功');'。這將記錄連接成功 – Akintunde007