Hi
I want to read/write constants in a file. To change the config with a browser.
<input type="text" name="testconstant">
output/change in a file
define("TESTCONSTANT", "Hello world.");
Is there a class for that?
read/write constants
Moderator: General Moderators
Doubt that.
You'll have to write code to open the file and change the contant values by examining the lines.
Regular Expressions can be used for this.
You'll have to write code to open the file and change the contant values by examining the lines.
Regular Expressions can be used for this.
Hi
Have someone experience with that?
OK, but I hope there is already a solution. Found this: http://pear.php.net/package/ConfigRegular Expressions can be used for this
Have someone experience with that?
Hi
Another one
http://www.zend.com/manual/function.bco ... nstant.php
But only in PHP5?
I tried it with Regular Expressions. Not my world.
Has anybody a easy solution to handle this?
Another one
http://www.zend.com/manual/function.bco ... nstant.php
But only in PHP5?
I tried it with Regular Expressions. Not my world.
Has anybody a easy solution to handle this?
- Buddha443556
- Forum Regular
- Posts: 873
- Joined: Fri Mar 19, 2004 1:51 pm
Filter for it in your config file?
Could use a little data checking too.
Code: Select all
if(isset($_GET['testconstant'])) {
define("TESTCONSTANT", $_GET['testconstant']);
} else {
define("TESTCONSTANT", "Hello world.");
}OK, thanks, but it must written statically in the config-file, not temporary. And I don't know, the Constants-Name (e.G. TESTCONSTANT) and how much Constants are in the file. It must be dynamic.
I think there is no existent solution for that (after 5 hours Google-Search). Probably I have to learn Regular Expressions. Arrggh.
I think there is no existent solution for that (after 5 hours Google-Search). Probably I have to learn Regular Expressions. Arrggh.