php读取sql2000的image字段,被截断的问题

php 存取sql server中类型的照片信息!

 1 <?php
 2 header("Content-Type:text/html;charset=gb2312");
 3 $url="http://www.jstzhrss.gov.cn/shenbao/user/index3.php";
 4 
 5 $conn=odbc_connect("sqlserver","exp_db","tzpxhk6664553") ; 
 6 $userface="select userface from PersonInfo where name='虞水'";
 7 //echo $uname;exit;
 8 $exc=odbc_exec($conn,$userface);
 9 $binary_string=odbc_result($exc,1) ;   //得到16进制的照片码
10 
11 $file = fopen("aa/".$filename,"wr");    //文件存储路劲
12 fwrite($file,$binary_string); //写入
13 fclose($file);
14 ?>

找到php.in,大概在1163行

; Handling of LONG fields. Returns number of bytes to variables. 0 means
; passthru.
; http://php.net/odbc.defaultlrl
odbc.defaultlrl = 4096  改成 40960000

重启phpstudy,问题解决啦

-------------------------

如果使用的是sql2005、sql2008以上版本,修改1701行,1705行

; Valid range 0 - 2147483647. Default = 4096.
mssql.textlimit = 40960000

; Valid range 0 - 2147483647. Default = 4096.
mssql.textsize = 40960000

原帖地址:http://bbs.csdn.net/topics/391841500?page=1

原文地址:https://www.cnblogs.com/skysowe/p/6145358.html