Is there a way in PHP to include a constant in a string without concatenating?define('MY_CONSTANT', 42);echo "This is my constant: MY_CONSTANT"; 解决方案 No. With Strings, there is no way for PHP to tell string data apart from constant identifiers. This goes for any of the string formats in PHP, including heredoc.constant() is an alternative way to get hold of a constant, but a function call can't be put into a string without concatenation either.Manual on constants in PHP 这篇关于在字符串中包含常量而不进行串联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-27 14:06