Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/266.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/69.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 字符串不能与特殊字符一起使用_Php_Mysql_String_Replace_Special Characters - Fatal编程技术网

Php 字符串不能与特殊字符一起使用

Php 字符串不能与特殊字符一起使用,php,mysql,string,replace,special-characters,Php,Mysql,String,Replace,Special Characters,更新后,我无法重命名类别。此字符串中必须有一个错误: 如果我使用 $categoryName = (!empty($categoryLang[$cat_details['category_id']])) ? $categoryLang[$cat_details['category_id']] : $cat_details['name']; $category_lang .= ($table_name == 'reverse_categories') ? '$reverse_categor

更新后,我无法重命名类别。此字符串中必须有一个错误:

如果我使用

 $categoryName = (!empty($categoryLang[$cat_details['category_id']])) ?  $categoryLang[$cat_details['category_id']] : $cat_details['name'];
  $category_lang .= ($table_name == 'reverse_categories') ? '$reverse_category_lang' : '$category_lang';
  $category_lang .= '[';
  $category_lang .= $cat_details['category_id'];
  $category_lang .= ']="';
  $category_lang .= $db->rem_special_chars($categoryName);
  $category_lang .= '";';
  $category_lang .= "\n"; }
我不能用特殊字符更新类别。如果我将$categoryName重命名为$cat_details['name',它可以工作,现在可以更新,但是现在类别特殊字符不工作

有人知道我怎么把这根绳子分开吗?
THX 4…

我不知道$category\u lang是否已经定义,但是,您是否尝试定义$category\u lang

$categoryName = (.............    
...

//Define the variable to let you add more text to the text string 
$category_lang = '';
// Now you can use .=
$category_lang .= ($table_name == 'reverse_categories') ? '$reverse_category_lang' : '$category_lang';
$category_lang .= '[';
$category_lang .= $cat_details['category_id'];
$category_lang .= ']="';
$category_lang .= $db->rem_special_chars($categoryName);
$category_lang .= '";';
$category_lang .= "\n"; } // <-- this } is a part of a function x(){ ?

看起来是错误的引语。你的意思是$reverse\u category\u lang:$category\u lang是的,$reverse\u category\u lang'会给你$reverse\u category\u lang作为字符串。想必您想看到它的实际值,所以只需删除“引号”或将其更改为。另外,我猜第一个$category_lang.=应该是just=但您仍然需要在其中包含一个字符串值。