php string传给safearray?怎么做

平台想钱想疯了 2008-06-25 05:09:38


$f = fopen("http://php");
$data = stream_get_contents($f,-1,0);
fclose($f);

php中,我用stream_get_contents()方法接收到的数据,是STRING类型,

现在要传到给COM, COM接口的参数类型是SAFEARRAY,我要怎么处理 ??

急....
...全文
153 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
inter_lxp 2008-07-01
  • 打赏
  • 举报
回复
数据类型的问题一直存在。转成二进制传送应该没问题。
fxs_2008 2008-06-30
  • 打赏
  • 举报
回复
这个我看过一篇文章说过
C里是将\0作为结整,PHP作为字符,要进行转码替换,好象要用到Pack
  • 打赏
  • 举报
回复

现在,我发现了问题,因为我接收到的数据,在http://PHP中把\0做为字符串处理 了,但是我传入到COM中时,COM一解析\0就当成结束了,所以挂了..

现在处理\0 后可以传入进去.也可以接收出来..
但问题又来出来了...我接收出来的数据现在是STRING类型,输出的时候要转为二进制,才能回传给调用的COM接口, 结果我发现我的PHP5.2.6这个版本,不支持GD,
我在每一个字符后面加上\0还原为二进制,结果,到是能让COM接收,但就是速度太慢,时间太长.. 而我想用imagecreatefromstring()却又不支持...晕死.
我从网上下载了一个php_gd2.dll放到了php5新建一个ext目录下,然后在php.ini中找到extension_dir这句改成下面的地址:

extension_dir = "D:\usr\local\php5\ext\"

再在,dynamic Extensions下面的;extension=msql.dll下面手工加入extension=php_gd2.dll (别人的都自己有,我的只有一个msql.dll,晕死.)
重启apache,可还是不支持GD...怎么办?



  • 打赏
  • 举报
回复
哇,好的,有星的就是不一样哟..
3KYOU..
  • 打赏
  • 举报
回复
CSDN看来也不行了啊...

不像以前...总有好多高手来....

fxs_2008 2008-06-26
  • 打赏
  • 举报
回复
或者,你传一个PHP的数组看看能不能成功(或者序列化传一下看看)
fxs_2008 2008-06-26
  • 打赏
  • 举报
回复
上面只说了可以从对象中取得属性和数组
另外,你再看看SAFEARRAY是如何构建的,向远程传递时是字符串,流,还是其他?可以去VC和VB版问一下
fxs_2008 2008-06-26
  • 打赏
  • 举报
回复
你要有时间可看看PHP手册上的com函数库

Many COM objects expose their properties as arrays, or using array-style access. In PHP 4, you may use PHP array syntax to read/write such a property, but only a single dimension is allowed. If you want to read a multi-dimensional property, you could instead make the property access into a function call, with each parameter representing each dimension of the array access, but there is no way to write to such a property.

PHP 5 introduces the following new features to make your life easier:


Access multi-dimensional arrays, or COM properties that require multiple parameters using PHP array syntax. You can also write or set properties using this technique.

Iterate SafeArrays ("true" arrays) using the the 节 called foreach 在 16 章 control structure. This works because SafeArrays include information about their size. If an array-style property implements IEnumVariant then you can also use foreach for that property too; take a look at the 节 called For Each for more information on this topic.


qianziai0912 2008-06-26
  • 打赏
  • 举报
回复
==偶来JF
  • 打赏
  • 举报
回复
是的啊..呵呵..赚钱忙...

看来,这70分,全给你好了..呵呵...
my_web 2008-06-26
  • 打赏
  • 举报
回复
的确是,高手都忙着赚钱去了
  • 打赏
  • 举报
回复
COM是用VC写的..,定义的类型就是safearray类型,原来在ASP中, data = Request.BinaryRead()读入数据后,能正常传入,现在,改为php, 则传入出问题了.
急....
my_web 2008-06-25
  • 打赏
  • 举报
回复
没有这个类型

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧