Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/239.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 替换“;用\";第1.2条_Php_Mysql_Strip_Doctrine 1.2 - Fatal编程技术网

Php 替换“;用\";第1.2条

Php 替换“;用\";第1.2条,php,mysql,strip,doctrine-1.2,Php,Mysql,Strip,Doctrine 1.2,这是我的问题 我使用Doctrine 1.2从数据库中获取数据,并将数据放在文本框中 文本框中的数据为19英寸x 12英寸 结果如下: <input type="text" value="19" x 12"" /> 我想我需要逃避所有的“与” 我的问题是: 我如何能够自动执行此操作,而不必进入所有脚本并生成str_replace() 谢谢大家。看一看,这应该可以解决问题。我会用 $string=htmlentities($text\u加引号,ENT\u引号); 回声'; 应该

这是我的问题

我使用Doctrine 1.2从数据库中获取数据,并将数据放在文本框中

文本框中的数据为19英寸x 12英寸

结果如下:

<input type="text" value="19" x 12"" />

我想我需要逃避所有的“与”

我的问题是: 我如何能够自动执行此操作,而不必进入所有脚本并生成str_replace()

谢谢大家。

看一看,这应该可以解决问题。

我会用

$string=htmlentities($text\u加引号,ENT\u引号);
回声';

应该能满足您的需要。

您可以在模型类中编写函数,如:

public function getInputValue() {
    return addslashes($this->_get('table_field_name'));
}
然后在视图中使用。 或者,您可以重写从具体表字段获取数据的函数:

public function getFieldname() {
    return addslashes($this->_get('table_field_name'));
}

addslashes可以替换为您想要在视图中获得实际需要的数据的任何内容。

您是否有实际使用的php代码。。。我建议添加斜杠,但我们需要一些上下文。为什么要避免使用php函数?我想您要求的解决方案是不要遍历所有代码。若您将数据作为对象获取,并通过获取属性,并且无论何时获取数据,都可以设置getter方法。假设您以这种方式获取属性:
$object->property设置:
公共函数getProperty(){返回htmlspecialchars($this->_get('property');}
public function getFieldname() {
    return addslashes($this->_get('table_field_name'));
}