使用php从链接获取keeks视频id


Getting keeks videos id from the link using php

我只需要从任何keeks视频链接获得视频Id

keeks.com 链接示例

https://www.keek.com/syahrin/keeks/QC06cab
https://www.keek.com/!QC06cab
https://www.keek.com/syahrin#QC06cab
https://www.keek.com/embed/QC06cab

我只需要QC06cab 的输出

您可以使用一个字符类来排除分隔符并将模式锚定到字符串的末尾:

if (preg_match('~[^/!#]++$~', $url, $match))
    print_r($match);