Urgent questions PHP version of the problem, 12:10 I have not eaten, everyone help!!
Hello, I used in the program WebSocket function, the program debugging no error, but to the service error, found on the internet, said PHP version of a http://s.yanghao.org/program/viewdetail.php?i=140457
The PHP version of my machine is 5.4, the server is 5.2, please PHP5.2 there is no convenient to replace the php5.3 namespace function, very urgent!
Require ("lib/splclassloader.php");
$classLoader = new Splclassloader ("WebSocket", "/lib");
$classLoader->register ();
$server = new \websocket\server ("124.172.243.71", 8000, false);//Error here
The contents of the error are as follows
Unexpected character in input: ' \ ' (ascii=92) state=1 in version
------Solution--------------------
A reply in the manual
--------------------------------------------------
A dot schaffhirt at sedna-soft Dot de02-feb-2010 06:24
Just in wonder, what the practical use of the namespace keyword is ...
It can explicitly refer to classes from the current namespace regardless of possibly ' use ' d classes with the same name fro M other namespaces. However, this does is not an apply for functions.
Example:
namespace Foo;
Class Xyz {}
Function abc () {}
?>
namespace Bar;
Class Xyz {}
Function abc () {}
?>
namespace Bar;
Use Foo
------Solution--------------------
Xyz;
Use Foo
------Solution--------------------
abc
New Xyz (); Instantiates \foo\xyz
New namespace
------Solution--------------------
Xyz (); Instantiates \bar\xyz
ABC (); Invokes \BAR\ABC regardless of the second use statement
------Solution--------------------
Ho!
------Solution--------------------
ABC (); It has-to-be invoked using the fully qualified name
?>
(Sorry, I had to use "
------Solution--------------------
"Instead of" \ ", as it is always discarded in the preview, except within a comment.)
Hope, this can save someone from some trouble.
Best regards.
----------------------------------------
------Solution--------------------
There are no namespaces in PHP5.2
You can delete the Declarations section about namespaces.
Degenerate into normal classes and functions