Are there any length limits on PHP echo?

2019-02-24 02:42发布

I have this script that fetches some data from mysql and then uses echo to output it. But, as the page have grown and gotten longer all of a sudden i have this weird behavior where it cuts of the end at 65535 chrs (when using strlen to check)

The data is all saved in MySQL, beyond the 65535 chrs showing when using echo.
EDIT: Sorry, it seems like NOT all data was saved, it was my WYSIWYG editor that made it look like all was saved but it wasent. (It auto closed unclosed tags making it look all ok when i opend the content again.)

Why is this happening?

All I do is;

$content= $row['content'];
echo $content;

2条回答
Root(大扎)
2楼-- · 2019-02-24 03:04

Certainly sounds like a length limit. You could always try something like this:

$content = str_split($row['content'], 65536);
foreach ($content as $part) {
    echo $part;
}
查看更多
甜甜的少女心
3楼-- · 2019-02-24 03:11

Are you sure it's a PHP issue? The MySQL TEXT field has a maximum size of 65535 characters. Make sure the text is actually in your database.

查看更多
登录 后发表回答