php 从字符串的开头和结尾删除双引号

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10262951/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-24 21:46:32  来源:igfitidea点击:

Removing double quotes from beginning and end of String

php

提问by Jeff Davidson

What I'm trying to find out is which php function allows me to remove double quotes from the beginning and end of a text string if they exist

我想要找出的是哪个 php 函数允许我从文本字符串的开头和结尾删除双引号(如果存在)

回答by Paul

Use the trimfunction:

使用修剪功能:

$str = '"Hello"';
echo trim($str, '"'); // Outputs Hello

回答by Nobita

Trimis your friend:

修剪是你的朋友:

trim($string,'"');