In the next novice, is using
Laravel
Framework and
xampp
Build a backend management system. Because there is a need to do the WebService interface function, the use of soap in PHP, but the development process has emerged
Function doesn't exist
Problem, the card for a long time, so come to help. Specific as follows:
There are so two PHP files:
①client.php, as a SOAP client
Path:C:\xampp\htdocs\my_project\app\Services\client.php
"http://localhost/my_project/app/Services/server.php", 'uri' => "http://localhost/", 'encoding' => 'UTF-8')); echo $client->hello();} catch (SoapFault $fault) { echo "Error: ", $fault->faultcode, ", String: ", $fault->getMessage();}
②server.php, as a soap service side
Path:C:\xampp\htdocs\my_project\app\Services\server.php
"localhost")); $soap->addFunction('hello'); $soap->handle();}catch (\SoapFault $fault) { echo "Error: ", $fault->faultcode, ", String: ", $fault->faultstring;}function hello(){ $model = new User; return "hello";}
Because there is a need to use a template, it is server.php
used in namespace
, and the User
way in which classes are use
referenced. But server.php
in this way SoapServer
, a slash is SoapFault
added to the front \SoapServer
and\SoapFault
Finally in the browser run C:\xampp\htdocs\my_project\app\Services\client.php
when the Error: SOAP-ENV:Server, String: Function 'hello' doesn't exist
error prompted, Baidu Google has not been the result, hope that experienced predecessors can point out, greatly appreciated!
Reply content:
Under Novice, the framework is being used Laravel
and xampp
a backend management system is being built. Because there is a need to do WebService interface function, the use of soap in PHP, but the development process occurred in Function doesn't exist
the problem, card for a long time, so come to help. Specific as follows:
There are so two PHP files:
①client.php, as a SOAP client
Path:C:\xampp\htdocs\my_project\app\Services\client.php
"http://localhost/my_project/app/Services/server.php", 'uri' => "http://localhost/", 'encoding' => 'UTF-8')); echo $client->hello();} catch (SoapFault $fault) { echo "Error: ", $fault->faultcode, ", String: ", $fault->getMessage();}
②server.php, as a soap service side
Path:C:\xampp\htdocs\my_project\app\Services\server.php
"localhost")); $soap->addFunction('hello'); $soap->handle();}catch (\SoapFault $fault) { echo "Error: ", $fault->faultcode, ", String: ", $fault->faultstring;}function hello(){ $model = new User; return "hello";}
Because there is a need to use a template, it is server.php
used in namespace
, and the User
way in which classes are use
referenced. But server.php
in this way SoapServer
, a slash is SoapFault
added to the front \SoapServer
and\SoapFault
Finally in the browser run C:\xampp\htdocs\my_project\app\Services\client.php
when the Error: SOAP-ENV:Server, String: Function 'hello' doesn't exist
error prompted, Baidu Google has not been the result, hope that experienced predecessors can point out, greatly appreciated!