在 PHP 中如何清除 WSDL 缓存?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/303488/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
In PHP how can you clear a WSDL cache?
提问by jW.
In through php_info()where the WSDL cache is held (/tmp), but I don't necessarily know if it is safe to delete all files starting with WSDL.
在php_info()WSDL 缓存所在的位置 ( /tmp),但我不一定知道删除所有以 WSDL 开头的文件是否安全。
Yes, I shouldbe able to just delete everything from /tmp, but I don't know what else this could effect if I delete any all WSDL files.
是的,我应该能够只删除/tmp.
回答by Owen
You can safely delete the WSDL cache files. If you wish to prevent future caching, use:
您可以安全地删除 WSDL 缓存文件。如果您希望防止将来缓存,请使用:
ini_set("soap.wsdl_cache_enabled", 0);
or dynamically:
或动态:
$client = new SoapClient('http://somewhere.com/?wsdl', array('cache_wsdl' => WSDL_CACHE_NONE) );
回答by user3259435
Remove all wsdl*files in your /tmpfolder on the server.
删除服务器上wsdl*文件/tmp夹中的所有文件。
WSDL files are cached in your default location for all cache files defined in php.ini. Same location as your session files.
WSDL 文件缓存在 php.ini 中定义的所有缓存文件的默认位置。与您的会话文件相同的位置。
回答by staabm
I recommend using a cache-buster in the wsdl url.
我建议在 wsdl url 中使用缓存破坏者。
In our apps we use a SVN Revision id in the wsdl url so the client immediately knows of changing structures. This works on our app because, everytime we change the server-side, we also need to adjust the client accordingly.
在我们的应用程序中,我们在 wsdl url 中使用了 SVN Revision id,因此客户端会立即知道更改的结构。这适用于我们的应用程序,因为每次我们更改服务器端时,我们还需要相应地调整客户端。
$client = new SoapClient('http://somewhere.com/?wsdl&rev=$Revision$');
This requires svn to be configured properly. Not on all repositories this is enabled by default.
这需要正确配置 svn。并非所有存储库都默认启用此功能。
In case you are not responsible for both components (server,client) or you don't use SVN you may find another indicator which can be utilised as a cache-buster in your wsdl url.
如果您不负责这两个组件(服务器、客户端)或者您不使用 SVN,您可能会发现另一个指标,它可以在您的 wsdl url 中用作缓存破坏者。
回答by Markomafs
if you already deployed the code or can't change any configuration, you could remove all temp files from wsdl:
如果您已经部署了代码或无法更改任何配置,则可以从 wsdl 中删除所有临时文件:
rm /tmp/wsdl-*
回答by peter_the_oak
Just for the reason of documentation:
仅出于文档的原因:
I have now (2014) observed that from all these valuable and correct approaches only one was successful. I've added a function to the WSDL on the server, and the client wasn't recognizing the new function.
我现在(2014 年)观察到,从所有这些有价值且正确的方法中,只有一种是成功的。我在服务器上的 WSDL 中添加了一个函数,但客户端无法识别新函数。
- Adding
WSDL_CACHE_NONEto the parameters didn't help. - Adding the cache-buster didn't help.
- Setting
soap.wsdl_cache_enabledto the PHP ini helped.
- 添加
WSDL_CACHE_NONE到参数没有帮助。 - 添加缓存破坏者没有帮助。
- 设置
soap.wsdl_cache_enabled为 PHP ini 有帮助。
I am now unsure if it is the combination of all three, or if some features are terribly implemented so they may remain useless randomly, or if there is some hierarchy of features not understood.
我现在不确定它是否是所有这三个的组合,或者某些功能是否实现得非常糟糕,因此它们可能会随机保持无用,或者是否存在某些不了解的功能层次结构。
So finally, expect that you have to check all three to solve problems like these.
所以最后,希望你必须检查所有三个来解决这些问题。
回答by Kiran Reddy
Edit your php.inifile, search for soap.wsdl_cache_enabledand set the value to 0
编辑您的php.ini文件,搜索soap.wsdl_cache_enabled并将值设置为0
[soap]
; Enables or disables WSDL caching feature.
; http://php.net/soap.wsdl-cache-enabled
soap.wsdl_cache_enabled=0

