I am eager to ask questions about the PHP version. I haven't eaten yet since pm. please help me!
Source: Internet
Author: User
I am eager to ask questions about the PHP version. I haven't eaten yet at PM. please help me !! Hello everyone, I used the websocket function in the program, the local program debugging does not report an error, but the transfer to the service will report an error, found on the Internet, said PHP version of a http://s.yanghao.org/program/viewdetail.php? I = 1404 I am eager to ask for PHP version questions. I haven't eaten yet at. please help me !!
Hello everyone, I used the websocket function in the program, the local program debugging does not report an error, but the transfer to the service will report an error, found on the Internet, said PHP version of a http://s.yanghao.org/program/viewdetail.php? I = 140457.
The PHP version on my machine is 5.4 and the server is 5.2. is it convenient to replace the namespace function of php5.3 in PHP5.2!
Require ("lib/SplClassLoader. php ");
$ ClassLoader = new SplClassLoader ("WebSocket", "/lib ");
$ ClassLoader-> register ();
$ Server = new \ WebSocket \ Server ("124.172.243.71", 8000, false); // An error is returned here.
The error message is 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
Just in case you 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 from other namespaces. However, this does not 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 --------------------
Foo
------ Solution --------------------
Abc (); // it has to be invoked using the fully qualified name
?>
(Sorry, I had to use"
------ Solution --------------------
"Instead of" \ ", as it was always discarded in the preview, cannot within a comment .)
Hope, this can save someone from some trouble.
Best regards.
----------------------------------------
------ Solution --------------------
No namespace in PHP5.2
You can delete the declaration section about the namespace.
Degrades to common classes and functions
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.