各位好,我的数据完整的存数据库中(10000字左右),用php 获取数据获取该字段内容时,为什么只能获取前部份内容,而获取的不是所有的内容
回复讨论(解决方案)
字段是什么类型的?
怎么会啊 你是不是用的var_dump输出的,然后安装了xdebug,安装xdebug用函数var_dump打印时会截断
数据库是mssql,字段是text类型的,这样取数据 $v['memo']=iconv("gbk", "UTF-8",$memo);然后直接echo,print_r都试了,显示的内容不全,但是确定已经在数据库里了
代码如下,其中memo是mssql的text
function getInfo()
{
ini_set('mssql.datetimeconvert','0');
ini_set("mssql.textsize",200000);
ini_set("mssql.textlimit",200000);
$sql="SET TEXTSIZE 65536";
$this->db->query($sql);
$id = getgpc('id', 'G');
$sql="select * from [peihuo].[dbo].[S_advset] where id=".$id;
$arrdata = $this->db->fetch_array_all($sql);
if($arrdata)
{
foreach($arrdata as $k => $v)
{
$memo=$v['memo'];
$v['title']=iconv("gbk", "UTF-8",$v['title']);
$v['memo']=iconv("gbk", "UTF-8",$memo);
echo $v['memo']."
";//这里不能读取所有内容
$arr[$k] = $v;
}
}
return $arr;
}
echo base64_encode($v['memo']);
贴出结果
如果贴不下,就
file_put_contents('test.txt', $v['memo']);
把 test.txt 放到网盘上
版主,我已经把文件传上去了网盘上
http://yun.baidu.com/xcloud/csdn/pan/disk/home
那个公路运输合同是我放入到数据中内容,那个text.txt是file_put_contents('test.txt', $v['memo']);的内容,编辑器用的是fckeditor
你放的地方不对!
csdn 的网盘是无法分享的,只有你自己看的到
有点奇怪,那你在phpmyadmin中能看到数据库的数据是完整的吗?
如果在phpmyadmin中看到的都不完整,就是插入时已经被截取了。
数据库字段类型是varchar的话那个长度得设置成10000以上 但估计没办法设置那么多
所以字段类型得改成text
可能写入的时候就被截取了
还有不要用echo 用print_r来看
存入数据库的数据是否有问题?已经被截断?
读取的时候,不应该被截断,除非你字符转换。
各们老大,我把文件传到我的服务去上了,http://www.56phw.com/test.rar,数据库中肯定有记录,是全的,就是echo 或print_r时,内容显示不全,只能显示前面大约2000字左右,数据库是mssql2005
function getInfo()
{
ini_set('mssql.datetimeconvert','0');
ini_set("mssql.textsize",200000);
ini_set("mssql.textlimit",200000);
$sql="SET TEXTSIZE 65536";
$this->db->query($sql);
$id = getgpc('id', 'G');
$sql="select * from [peihuo].[dbo].[S_advset] where id=".$id;
$arrdata = $this->db->fetch_array_all($sql);
if($arrdata)
{
foreach($arrdata as $k => $v)
{
$memo=$v['memo'];
$v['title']=iconv("gbk", "UTF-8",$v['title']);
$v['memo']=iconv("gbk", "UTF-8",$memo);//这里是内容,就是这里显示不全,
$arr[$k] = $v;
}
}
return $arr;
}
你放个 word 文档是什么意思?
就是把那个WORD的内容放到mssql表的memo字段中,是text类型的
你在 sql server 2005 的管理工具中能看到完整的内容吗?
ini_set("mssql.textsize",200000);
ini_set("mssql.textlimit",200000);
没有生效,默认是 4096
你确认用的是 php_mssql 扩展吗?
我确定在mssql2005中能看到完整的记录
ini_set("mssql.textsize",200000);
ini_set("mssql.textlimit",200000);
好像没有生效,不知道咋回事
看看你的数据库类定义
最近也遇到这个问题,不知道楼主解决没有。
同时还有直接执行Sql语句时会提示:message: 不能用 DB-Library (如 ISQL)或 ODBC 3.7 或更早版本将 ntext 数据或仅使用 Unicode 排序规则的 Unicode 数据发送到客户端。 (severity 16)
需要加 CASE(test1 as TEXT) as test 才行。
查了一下
在php.ini中有这么一句配置。你看对你有用没有。
; Valid range 0 - 2147483647. Default = 4096.
mssql.textsize = 20480
我也遇到了类似的问题 我的问题是 在进行查询的时候 我拼了一个巨长的sql字符串 存放在变量$sql中 然而在执行时报错了 我发现 这个$sql变量的长度是有限制的 如何才能完整赋值呢 求解啊 这个大sql可以少写至少几百行代码啊

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.

In PHP, use the clone keyword to create a copy of the object and customize the cloning behavior through the \_\_clone magic method. 1. Use the clone keyword to make a shallow copy, cloning the object's properties but not the object's properties. 2. The \_\_clone method can deeply copy nested objects to avoid shallow copying problems. 3. Pay attention to avoid circular references and performance problems in cloning, and optimize cloning operations to improve efficiency.

PHP is suitable for web development and content management systems, and Python is suitable for data science, machine learning and automation scripts. 1.PHP performs well in building fast and scalable websites and applications and is commonly used in CMS such as WordPress. 2. Python has performed outstandingly in the fields of data science and machine learning, with rich libraries such as NumPy and TensorFlow.

Key players in HTTP cache headers include Cache-Control, ETag, and Last-Modified. 1.Cache-Control is used to control caching policies. Example: Cache-Control:max-age=3600,public. 2. ETag verifies resource changes through unique identifiers, example: ETag: "686897696a7c876b7e". 3.Last-Modified indicates the resource's last modification time, example: Last-Modified:Wed,21Oct201507:28:00GMT.

In PHP, password_hash and password_verify functions should be used to implement secure password hashing, and MD5 or SHA1 should not be used. 1) password_hash generates a hash containing salt values to enhance security. 2) Password_verify verify password and ensure security by comparing hash values. 3) MD5 and SHA1 are vulnerable and lack salt values, and are not suitable for modern password security.

PHP is a server-side scripting language used for dynamic web development and server-side applications. 1.PHP is an interpreted language that does not require compilation and is suitable for rapid development. 2. PHP code is embedded in HTML, making it easy to develop web pages. 3. PHP processes server-side logic, generates HTML output, and supports user interaction and data processing. 4. PHP can interact with the database, process form submission, and execute server-side tasks.

PHP has shaped the network over the past few decades and will continue to play an important role in web development. 1) PHP originated in 1994 and has become the first choice for developers due to its ease of use and seamless integration with MySQL. 2) Its core functions include generating dynamic content and integrating with the database, allowing the website to be updated in real time and displayed in personalized manner. 3) The wide application and ecosystem of PHP have driven its long-term impact, but it also faces version updates and security challenges. 4) Performance improvements in recent years, such as the release of PHP7, enable it to compete with modern languages. 5) In the future, PHP needs to deal with new challenges such as containerization and microservices, but its flexibility and active community make it adaptable.

The core benefits of PHP include ease of learning, strong web development support, rich libraries and frameworks, high performance and scalability, cross-platform compatibility, and cost-effectiveness. 1) Easy to learn and use, suitable for beginners; 2) Good integration with web servers and supports multiple databases; 3) Have powerful frameworks such as Laravel; 4) High performance can be achieved through optimization; 5) Support multiple operating systems; 6) Open source to reduce development costs.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function