Getting a syntax error unexpected T_STRING for namespace line

余生长醉 提交于 2019-11-28 03:01:47

问题


Well, I keep getting

Parse error: syntax error, unexpected T_STRING in /path/to/index.php on line 2

Googled my arse off and still nuthing, so far the index.php contains:

<?php
namespace Infire; # Line 2
...

I am using PHP 5.1

Any ideas?


回答1:


The PHP namespace is only supported in PHP 5.3+ version

Check this PHP 5.3.0 Release Announcement




回答2:


I've found namespaces introduced in PHP 5.3 to suffer from multiple usability problems due to performance trade-offs, limitations of PHP's parser, collisions with other PHP features and unfortunate design decisions.



来源:https://stackoverflow.com/questions/12650836/getting-a-syntax-error-unexpected-t-string-for-namespace-line

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!