php出現“syntax error, unexpected T
PHP中的“syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM”錯誤,可能是因為美元符號$的誤用,看下面一種情況 class Test{ static function test_c(){ echo "test"; } } $class="Test"; $method="test_c"; $class::$method(); 上面類似的代碼,當php版本低于5.3時就會報錯,低版本php不支持變量做類的靜態函數名。 php5.3之后是支持的。 php5.3之前可以這樣寫: class Test{ static function test_c(){ echo "test"; } } $class="Test"; $method="test_c"; eval("$class::$method();"); 用eval函數,動態執行php代碼可以避免unexpected T_PAAMAYIM_NEKUDOTAYIM錯誤。
作者:挑燈碼字
來源鏈接:https://www.cnblogs.com/tdkj/p/3141935.html
上一篇:pymysql.err.InternalError: (1054, Unknown column 'IC4000' in 'where clause')
下一篇:基于Metronic的Bootstrap開發框架經驗總結(11)
下一篇:基于Metronic的Bootstrap開發框架經驗總結(11)
相關文章:
- 502 bad gateway是什么意思,502 bad gateway什么原因怎么解決
- Linux 修改mysql Root密碼
- shell script中的syntax error near unexpected token `then' 問題
- 數據安全防護措施有哪些
- your MySQL server version for the right syntax to use near '.`22`' at line 1
- 編譯器開發系列
- 優化checkbox和radio,類似Bootstrap中的iCheck
- java.io.FileNotFoundException: class path resource 運行ssm項目報的錯誤
- MySQL8管理系列之二:從5.5升級到8的問題處理
- ICMP報文的格式和種類