我有一个包含一个大文本字段的类,该字段将包含可能是合同或商业表格的文本,到目前为止,这是我的代码:
public function saveAction()
{
if (isset ($_POST['Save']) && $this->isPostSafe()) {
$form = Form::getPostObject();
$form->text = addslashes($form->text);
var_dump($form);
$form->save($this->_databaseConnection);
}
$this->redirect('/forms');
}
public function __construct()
{
$company_info = Config::get('Company');
foreach ($company_info as $setting => $value) {
$this->variables[$setting] = $value;
}
$this->variables = serialize($this->variables);
}
public function set($name, $value)
{
$values = unserialize($this->variables);
$values[$name] = $value;
$this->variables = serialize($this->variables);
}
public function render()
{
var_dump($this->variables);
$values = unserialize($this->variables);
foreach ( $values as $key => $value) {
$from = "[@$key]";
$this->text = str_replace($from, $value, $this->text);
}
return $template;
}
问题是 var_dump 给了我未序列化的字符串,我尝试了 base64_encode 并没有解决问题