我想重定向页面:
http://www.mysite.com/samplepage/
Run Code Online (Sandbox Code Playgroud)
类似的页面http://www.mysite.com/samplepage/samplepage2/不得重定向.
这是我目前的.htaccess代码:
RedirectMatch 301 ^/samplepage/ /new-samplepageurl
Run Code Online (Sandbox Code Playgroud)
问题:这个也重定向网址:
http://www.mysite.com/samplepage/samplepage2/
我可以将重定向限制为仅限于一条确切的路径吗?
我有一个像这样的字符串:
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, https://www.youtube.com/watch?v=7TL02DA5MZM when an unknown printer took a galley of type and scrambled it to make a type
Run Code Online (Sandbox Code Playgroud)
这就是我所拥有的:
preg_match("(?:http://)?(?:www.)?(?:youtube.com|youtu.be)/(?:watch\?)?([^\s]+?)", $content, $m);
var_dump( $m );
Run Code Online (Sandbox Code Playgroud)
并希望从中提取YouTube链接。视频ID也可以。
谢谢您的帮助!
我正在尝试使文件可在 Safari 中下载。这是我的代码:
<?php
$file = $_GET['file'];
header ("Content-Disposition: attachment");
header ("Content-type: application/octet-stream");
header ("Content-disposition: attachment; filename=".$file.";");
header("Content-Length: ".filesize($file));
readfile($file);
exit;
?>
Run Code Online (Sandbox Code Playgroud)
它在 FF 中工作正常,但在 Safari 中我得到一个 0kb 文件。
我想我发送的标题有问题。可能是什么错误?