I want to create a file in php named config.php with some string similar to this:
$this->name = 'Example';
And in the file index.php a string like this:
<title><?php echo $this->name; ?></title>
I've see this in another site but i don't know how this works, can someone help me? Thank you very much!
I try this:
config.php
<?php
final class Settings {
public static $TRUE = "1", $FALSE = "0";
public function __construct($connect = true) {
$this->name = 'Example';
}
}
?>
index.php
<html>
<head>
<title><?php echo $this->name; ?></title>
</head>
<body>
</body>
</html>
You can take a reference from here
$my_file = 'config.php';
$handle = fopen($my_file, 'w') or die('Cannot open file: '.$my_file);
$data = 'This is the data';
fwrite($handle, $data);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.