How does the data read from the database correspond to defined constants? Consstant. php: define (town_9, Hengli); define (town_10, Qiaotou); define (town_11, Xie Gang); define (town_12, Dongkeng); define (town_13, Changping ); define (town_14, skip step); how does the data read from the database correspond to the defined constant?
Consstant. php:
Define ("town_9", "Hengli ");
Define ("town_10", "");
Define ("town_11", "Xie Gang ");
Define ("town_12", "Dongkeng ");
Define ("town_13", "Changping ");
Define ("town_14", "");
Define ("town_15", "dalang ");
Define ("town_16", "Huangjiang ");
Test. php:
... // Database operations
Echo $ row [0]; // $ row [0] the output is town_14
?>
In this way, running test. php shows that it is town_14, and the defined constant step is output. how is this good?
------ Solution --------------------
Define ("town_9", "Hengli ");
Define ("town_10", "");
Define ("town_11", "Xie Gang ");
Define ("town_12", "Dongkeng ");
Define ("town_13", "Changping ");
Define ("town_14", "");
Define ("town_15", "dalang ");
Define ("town_16", "Huangjiang ");
// Database operations
$ Row = array ();
$ Row [0] = "town_14 ";
$ Defined_constants = get_defined_constants ();
Echo $ defined_constants [$ row [0]; // skip step