实现一个php开发客户端,通过ice中间件访问服务器端的demo程序代码如下:
<?php require 'Ice.php'; ini_set("display_errors","1"); global $ICE; Ice_loadFile("profile_Conn"); try {
$Base=$ICE->stringToProxy("SimpleConn:default -h 172.16.0.210 -p 10000");
$Manager=$Base->ice_checkedCast("::Demo::IceTest");
$Properties=$Manager->insert("limengyu",25);
echo $Properties;
}
catch( Exception $e ) {
print_r($e);
}
?>
测试后报错如下:php error:call to undefined function Ice_loadprofile
经查,原因如下:The Ice extension for PHP underwent significant changes in 3.4 and is not backward-compatible with Ice 3.3. There's a section in the 3.4 release notes that explains these changes.
求助使用ICE3.4.2的情况下,如何用php访问slice文件,从而完成php通过ice访问服务器端的功能
<?php require 'Ice.php'; ini_set("display_errors","1"); global $ICE; Ice_loadFile("profile_Conn"); try {
$Base=$ICE->stringToProxy("SimpleConn:default -h 172.16.0.210 -p 10000");
$Manager=$Base->ice_checkedCast("::Demo::IceTest");
$Properties=$Manager->insert("limengyu",25);
echo $Properties;
}
catch( Exception $e ) {
print_r($e);
}
?>
测试后报错如下:php error:call to undefined function Ice_loadprofile
经查,原因如下:The Ice extension for PHP underwent significant changes in 3.4 and is not backward-compatible with Ice 3.3. There's a section in the 3.4 release notes that explains these changes.
求助使用ICE3.4.2的情况下,如何用php访问slice文件,从而完成php通过ice访问服务器端的功能
写错了
引入路径错了没
路径没问题,经过查询提示如下:The Ice extension for PHP underwent significant changes in 3.4 and is not backward-compatible with Ice 3.3. There's a section in the 3.4 release notes that explains these changes.
所以求助3.4.2版本的slice文件如何用php访问
冰PHP的扩展经历了3.4显著变化,不能用冰3.3向后兼容。 3.4发行说明,解释这些变化的一个部分。你很执着,这很好。不过向一群不知道 ice 是何物的人去请教如何修改,也太勉为其难了吧
经查如下:
In this release, Slice files must be translated using the new compiler slice2php. // PHP - Old API
Ice_loadProfile('Name1');// PHP - New API
$initData = new Ice_InitializationData;
$initData->properties = Ice_getProperties('Name1');
$ICE = Ice_initialize($initData);总结:3.4版本中不能再直接访问slice文件,需要经过slice2php生成客户端接口再进行行调用
结贴 感谢楼上几位热心帮助