$var=<a href="/abcd/100th-indian-science-congress">100th Indian Science Congress</a>;
在上面我只是想连接“
答案 0 :(得分:2)
$result = str_replace(" ", "-", $var);
答案 1 :(得分:0)
preg_match ('/a href="(.*?)"/', $var, $matches);
结果应该是$ matches [1];
答案 2 :(得分:0)
<?php
$var= '<a href="/abcd/100th-indian-science-congress">100th Indian Science Congress</a>';
$url = preg_match('/<a href="(.+)">/', $var, $match);
$outcome = basename($match[1]);
?>
结果见: http://sandbox.onlinephpfunctions.com/code/b4eea464a27c02d97e7bdd42fa959ff12884de96