扩展字符限制

时间:2012-11-14 01:34:29

标签: php

是否有人为博客制作撰写表单?

我有这个问题在我的本地主机上运行得很好但是当我尝试在服务器上传时,事情就没有用了。

我的问题是,当我在localhost运行时,它接受无限数量的字符并以“text”数据类型保存到数据库,但在网站上运行它只接受10,000个字符,除此之外它返回错误。这可能是什么问题?

这是我的代码。

<form action="savepost.php" method="POST">
<fieldset style="width:600px; height:580px">
<br><strong>Title</strong> <input id="posttitle" name="posttitle" type="text">
<br><br><strong>Content</strong>
<br><textarea id="postform" name="postform" style="width:600px; height:450px; resize: none"></textarea>
<br><input type="submit" value="Post" id="postbutton"/>
</fieldset>
</form>

savepost.php基本上是一个mysql插入过程。

3 个答案:

答案 0 :(得分:1)

1-确保本地和托管服务器中的数据库架构表中的数据类型设置为TEXTLONGTEXTMEDIUMTEXT

TEXT : 65,000 characters
MEDIUMTEXT: 16 million characters
LONGTEXT : 4 trillion

2-在 php.ini 中将post_max_size设置为所需的百万字符数。默认为(在WAMP中)post_max_size = 8M

答案 1 :(得分:0)

只需更改MySQL数据库架构即可允许超过10,000个字符的文本。

根据此文档(http://dev.mysql.com/doc/refman/5.0/en/blob.html),您应该使用LONGTEXT类型,其中包含4个千字节的文本,当然有足够的空间:)

答案 2 :(得分:0)

尝试在php.ini或.htaccess

中检查/设置
post_max_size=20M
相关问题