Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 为什么要发送脚本/n?_Php_Frameworks_Kohana - Fatal编程技术网

Php 为什么要发送脚本/n?

Php 为什么要发送脚本/n?,php,frameworks,kohana,Php,Frameworks,Kohana,资料来源: 控制器- Model::factory('index')->send_comment(mysql_real_escape_string($name), mysql_real_escape_string($artcl_id), mysql_real_escape_string($text), mysql_real_escape_string(time()), mysql_real_escape_string($ip)); Model

资料来源:

控制器-

Model::factory('index')->send_comment(mysql_real_escape_string($name), mysql_real_escape_string($artcl_id), mysql_real_escape_string($text), mysql_real_escape_string(time()), mysql_real_escape_string($ip));
                        Model::factory('index')->update_comment_count($artcl_id);
在此之前,使用trim()函数检查了$\u POST数据,$text是trim($\u POST['text'])

但是当我写评论的时候-

Hello!

This is a comment!
向数据库发送脚本

Hello!/n/nThis is a comment!
鉴于—

<?php echo htmlspecialchars(nl2br($comment['text'])); ?>


哪里出错了?

我假设它发送了
你好\n\n这是一条评论并且没有错误。

一切正常

我假设它发送了
你好\n\n这是一条评论并且没有错误。

一切正常

假设炮弹上校是正确的,并且您使用数据库模块(ORM使用它,只是说),您不必花费精力来逃避输入。但是,如果要向数据库发送未经转换的输入,则必须花费大量精力

请参见和,它们在整个数据库模块中使用


注:始终验证输入。

假设Col.Shrapnel是正确的,并且您使用数据库模块(ORM使用它,只是说),您不必花费精力来逃避输入。但是,如果要向数据库发送未经转换的输入,则必须花费大量精力

请参见和,它们在整个数据库模块中使用

注意:始终验证输入