Php constant customization and usage? The instance code is as follows: & lt ;? Php *? * Tochangethistemplate, chooseTools | Templates? * Andopenthetemplateintheeditor .***? * DescriptionofclassConstSample? Php constant customization and usage
?
The instance code is as follows:
/*
? * To change this template, choose Tools | Templates
? * And open the template in the editor.
*/
/**
? * Description of classConstSample
? *
? * @ Author liujl
? */
Class classConstSample {
??? Const constVarTest = "http://www.my400800.cn </a>
";
??? Static public function? ShowMsgTest (){
??????? Echo "outputs constant values using internal methods:". self: constVarTest;
??? }
}
// Constant call output test
ClassConstSample: showMsgTest ();
Echo "direct output constant value:". classConstSample: constVarTest;
?>
?
?
The output result is as follows:
?
?
Output constant value: http://www.my400800.cn using internal method
Direct output constant: http://www.my400800.cn
?
Output resultAs follows: