Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/283.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中从url字符串中删除引号_Php_Wordpress - Fatal编程技术网

如何在php中从url字符串中删除引号

如何在php中从url字符串中删除引号,php,wordpress,Php,Wordpress,我正在开发一个wordpress插件,它使用video js lib来流式传输视频,但我不知道我的代码如何在提供给播放器的所有url中自动生成这个(“and”) 这就是我们所说的,这是文件的url: "”https://s3-us-west-2.amazonaws.com/test-past3/data/Andrew+Cranston+-+Banners+of+Progress.mp4″" 这是我的视频播放器代码: <video class="video-js vjs-skin-flat

我正在开发一个wordpress插件,它使用video js lib来流式传输视频,但我不知道我的代码如何在提供给播放器的所有url中自动生成这个(“and”)

这就是我们所说的,这是文件的url:

"”https://s3-us-west-2.amazonaws.com/test-past3/data/Andrew+Cranston+-+Banners+of+Progress.mp4″"
这是我的视频播放器代码:

<video class="video-js vjs-skin-flat-red vjs-16-9" id="<?php print $attr['video_id'];?>" style="max-width: 100%;"
          controls
          preload="<?php print $attr['preload']; ?>"
        width="<?php print $width?>"
        <?php print $muted ? "muted" : ""?>
        height="<?php print $height?>" 
        poster="<?php print $attr['poster'];?>"
          data-setup='{
            "plugins": {
              "vastClient": {
                "adTagUrl": "<?php print $attr['adtagurl']; ?>",
                "adCancelTimeout": 5000,
                "adsEnabled": true
                }
              }
            }'>
        <source src="<?php  print $attr['url']; ?>" type="<?php print $mime_type ?>"></source>

        <p class="vjs-no-js">
          To view this video please enable JavaScript, and consider upgrading to a
          web browser that
          <a href="http://videojs.com/html5-video-support/" target="_blank">
            supports HTML5 video
          </a>
        </p>
      </video>
只需使用以下功能:

<source src="<?php print substr($attr['url'], 1, -1); ?>"

另外两个解决方案,带和

但在这种特殊情况下更简单、更快(从字符串中删除第一个和最后一个字符)

如果您
var\u dump($attr)你得到了什么?有报价吗?如果是,如何填充
$attr
str_replace(['”', '″'], '', $url);
preg_replace('/[”″]+/', '', $url);
substr($url, 1, -1);