Php 从mysql行中的字符串中删除一个单词
我试图从数据库中的字符串中删除一个单词 字符串是Php 从mysql行中的字符串中删除一个单词,php,Php,我试图从数据库中的字符串中删除一个单词 字符串是$keywords=tech、sms、利比亚、tax 假设我想从字符串中删除利比亚,我该如何使用MySQL的函数。使用MySQL的函数。为了清晰起见,我认为您可能需要将字符串分解为数组,删除不需要的元素,然后重新构建字符串。像这样: $keywords = 'tech,sms,libya,tax'; // Set String $keywords = explode(',', $keywords); // Explode into
$keywords=tech、sms、利比亚、tax
假设我想从字符串中删除利比亚,我该如何使用MySQL的函数。使用MySQL的函数。为了清晰起见,我认为您可能需要将字符串分解为数组,删除不需要的元素,然后重新构建字符串。像这样:
$keywords = 'tech,sms,libya,tax'; // Set String
$keywords = explode(',', $keywords); // Explode into array
unset($keywords[ array_search('libya', $keywords) ]); // Unset the array element with value of 'libya'
$keywords = implode(',',$keywords); // Reconstruct string
我认为为了清晰起见,您可能需要将字符串分解成一个数组,删除不需要的元素,然后重建字符串。像这样:
$keywords = 'tech,sms,libya,tax'; // Set String
$keywords = explode(',', $keywords); // Explode into array
unset($keywords[ array_search('libya', $keywords) ]); // Unset the array element with value of 'libya'
$keywords = implode(',',$keywords); // Reconstruct string