简体   繁体   English

PHP将名称空间与soap结合使用

[英]PHP use namespace with soap

I am writing a php code. 我正在写一个php代码。

<?php 

    namespace includeV5{

         $soapServer=new SoapServer(null,array("uri"=>"soapT.php"));

     }      
 ?>

The Above Code will display the error message: Fatal error: Class 'includeV5\\SoapServer' not found . 上面的代码将显示错误消息: 致命错误:未找到类'includeV5 \\ SoapServer'

If I don't use the namespace, it will execute successfully. 如果我不使用命名空间,它将成功执行。

Inside namespace you must provide absolute namespace path. 在名称空间内部,您必须提供绝对的名称空间路径。 This code will work both in namespace or not: 这段代码无论在命名空间中都可以使用:

$soapServer = new \SoapServer(null,array("uri"=>"soapT.php"));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM