【发布时间】:2018-02-17 01:07:26
【问题描述】:
我需要从 codeigniter 中删除 \,
这是我的输出:
{
"id": "3496",
"label": "B\\'less S\\'On Chicken Leg 200-240g",
"sku": "",
"cat_id": "72",
"slug": "b-less-s-on-chicken-leg-200-240g",
"product_min_order_qty": "1",
"product_unit_type": "pkt",
"alter_unit_type": "",
"product_short_desc": null,
"product_long_desc": "B\\'less S\\'On Chicken Leg 200-240g\r\n\r\n8 X 2kg / ctn",
"image": null
}
下面是我的代码:
$product_res = $this->Mydb->get_all_records('*', 'table_name');
$responseData = array("status" => 'ok',"categories" => $category_res,"products" => $product_res,"search_count" => $search_count, "Response" => array("response" => "Success", "response_code" => 1));
$this->output->set_content_type('application/json;');
$this->output->set_header('Access-Control-Allow-Origin: *');
return $this->output->set_output(json_encode($responseData,JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
【问题讨论】:
-
str_replace怎么样? -
为什么?后腰带正在逃逸
-
@TobiasF。需要删除阵列...!我试过 str_replace,stripslashes , mysqli_real_escape_string 但没有什么对我有用
标签: php json web-services codeigniter codeigniter-3