When a variable defined by the const keyword is concatenated with a string and assigned to another const variable,
<code>报syntax error, unexpected '.', expecting ',' or ';' </code>
The code is as follows
<code>const a = '你好'; const b = a.'certs/';//直接报错</code>
Can you please help me
When a variable defined by the const keyword is concatenated with a string and assigned to another const variable,
<code>报syntax error, unexpected '.', expecting ',' or ';' </code>
The code is as follows
<code>const a = '你好'; const b = a.'certs/';//直接报错</code>
Can you please help me
Nothing to help, the grammar doesn’t allow you to write like this.
Const definitions cannot use operators, variables and the like.
Besides what a is, at least it should be const b = self::a . 'certs/', although it is still illegal.
You lack context. You can only use it in a class. For external PHP constants, use define
PHP constants