<?php
$file = 'index.html';
$str = file_get_contents($file);
$text = 'href="/zx.html"';
$str = preg_replace('/href\s*=\s*(?:"([^"]*)"|\'([^\']*)\'|([^"\'>\s]+))/', $text, $str);
if(file_put_contents($file,$str)){
echo "change url success";
}
$file = 'index.html';
$str = file_get_contents($file);
$text = 'href="/zx.html"';
$str = preg_replace('/href\s*=\s*(?:"([^"]*)"|\'([^\']*)\'|([^"\'>\s]+))/', $text, $str);
if(file_put_contents($file,$str)){
echo "change url success";
}