mssql_fetch_object 文本字符限制?

2022-01-20 00:00:00 sql fetch php

我正在使用 mssql_fetch_object 从 MSSQL 表中获取一些数据,但页面上的文本似乎被截断了.

I'm fetching some data from an MSSQL table using the mssql_fetch_object, but the text appears to cut off on the page.

数据都在表格中,但在视图页面中似乎被截断了.

The data is all there in the table, but it seems to cut off in the view page.

有没有其他人遇到过这个问题并且可能知道解决方法?这是我的代码;

Has anyone else encountered this problem and perhaps knows of a workaround? Here is my code;

<?php include('includes/session.php');
$query = "SELECT content FROM pages WHERE id = '11'";
$result = mssql_query($query);
$page = mssql_fetch_object($result);
?>

<div id="leftcol">
<?php echo stripslashes($page->content) ?>
</div>

推荐答案

我不熟悉在php中使用mssql,但是我只是尝试了一个使用mysql的例子,没有问题.

I'm not familiar with using mssql in php, but I just tried an example using mysql without problem.

我觉得这很可疑

VAR_DUMP() 返回字符串(4096)

VAR_DUMP() returned string(4096)

所以我做了一些谷歌搜索并找到了这个链接

so I did some googling and found this link

http://www.bram.us/2007/07/05/my-dotd-ms-sql-vs-php-4096-is-the-default-limit/

建议将 php.ini 中的 mssql.textlimit 和 mssql.textsize 更改为 1048576(即 2^20),默认为 4096.希望对您有所帮助.

It suggests to change mssql.textlimit and mssql.textsize to 1048576 (which is 2ˆ20) in your php.ini as the default is 4096. Hope that helps.

php.ini

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

相关文章