I make a website on php and want to read some information from text file. the reason is if, i want to update connection string, data base name, hyperlinks,echo messages etc. then i don't want to update my php code i just replace that text in text file and the relative changes reflects in php file.
For example,
1. A php file :
<?php
$servername = "Server_Name"; //Comes from db_config.txt file
$username = "User_Name"; //Comes from db_config.txt file
$password = "Password"; //Comes from db_config.txt file
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Conn_Succ_Msg"; //Comes from db_config.txt file
?>
2. A text file like : (db_config.txt)
Server_Name = localhost
User_Name = abc
Password = 123
Conn_Succ_Msg = Connected successfully
I study "PHP 5 File Open/Read/Close" from http://www.w3schools.com/php/php_file_open.asp but not getting how to implement this even if it possible in xml file, etc also fine. Or can it possible with java scripts, jquery etc. Any idea how to do this ?