在PHP中删除字符串开头和结尾的引号 [英] Remove quotes from start and end of string in PHP

查看:504
本文介绍了在PHP中删除字符串开头和结尾的引号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的字符串:

"my value1" => my value1
"my Value2" => my Value2
myvalue3 => myvalue3 

我需要在结尾处除去"(双引号),如果它们存在,但是如果String中有这种字符,则应将其保留在那里.示例:

I need to get rid of " (double-quotes) in end and start, if these exist, but if there is this kind of character inside String then it should be left there. Example:

"my " value1" => my " value1

如何在PHP中执行此操作-是否有此功能,或者我必须自己编写代码?

How can I do this in PHP - is there function for this or do I have to code it myself?

推荐答案

trim($string,'"');

此处是来源

这篇关于在PHP中删除字符串开头和结尾的引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆