【发布时间】:2015-04-16 08:07:45
【问题描述】:
我在 CodeIgniter 中的 Disallowed Key Characters 中找到解决方案时遇到了这个问题。我的问题是,我希望 £ 符号将通过我的网址传递。
例如,
- 我有这个产品
testing-product-nutella。 - 我想在
testing-product-nutella£之外添加一个£符号,有点像这样。 下面是我的代码
//--------------------------------------------- ------------------------------------// //--------------------------> 建立产品列表数据---------------- ----------// //------------------------------------------------ ---------------------------------//
$prod_list = Array();
foreach($prods_query as $prod)
{
//echo htmlentities($prod['prod_name']);
//print_r($prod);
//$prod_name_url = Make_into_url($prod['prod_name']);
$prod_name_url = htmlentities($prod['prod_name']);
print_r($prod_name_url);
// get the minimum order quantity and price from db
if ($min_price = $this->Price_model->Get_listing_price($prod['prod_id']))
{
$min_order_qty = $min_price['qty_value'];
$min_order_price = $min_price['price_amount'] > 0 ? number_format($min_price['price_amount'], 2) : false;
}
else
{
// this shouldn't happen but just in case...
$min_order_qty = "";
$min_order_price = "";
}
// get the default image for the product from the database
$default_pic_row = $this->Picture_model->Get_default_product_picture($prod['prod_id']);
// get a list of all the special categories that a product is in
$product_spec_cats = $this->Special_category_model->Get_product_special_cats($prod['prod_id']);
// is the product on special offer, if so, get the details
$product_spec_off = $this->Special_offer_model->Get_product_special_offer_details($prod['prod_id']);
$nameUrl = urlencode($prod_name_url);
echo "<pre>";
echo $nameUrl;
echo "</pre>";
$prod_list[] = Array(
"prod_id" => $prod['prod_id']
,"prod_name" => urldecode($nameUrl)
,"prod_min_price" => $min_order_price
,"prod_min_qty" => $min_order_qty
,"prod_desc" => $prod['prod_desc']
,"prod_code" => $prod['prod_code']
,"prod_pic_thumb" => $default_pic_row['pic_thumb']
,"product_colours_image" => ""
,"prod_spec_cats" => $product_spec_cats
,"prod_spec_off" => $product_spec_off
);
}
当我尝试添加 £ 符号时,它显示不允许使用键字符。我希望当我添加特殊字符并传入 url 时,产品将通过特殊字符显示。
我尝试查看system/libraries/Input.php 文件中的文件并尝试更改function _clean_input_keys 中代码的一个小位,但它没有用。有人可以帮我弄清楚这件事吗?非常感谢任何帮助。
TIA
【问题讨论】:
-
你的 CodeIgniter 版本是什么?
-
嗯我不知道..也许 2+ 我只是在解决一些问题
-
显示
print_r($prod_name_url)和echo $nameUrl的输出并用实际的错误消息注释哪一行抛出错误 -
这是 print_r($prod_name_url) 50ml 标准夹式洗手液£50ml 标准夹式洗手液£ 和 $nameUrl = urlencode($prod_name_url);回声“
”;回声 $nameUrl;回声“
”;显示这个 50ml+Standard+Clip+Hand+Sanitisers%26pound%3B -
你好有人可以帮我吗?
标签: php codeigniter