ihavealinkthatissentthrowsomephp :
echo 'voir sa galerie ';
$galerry links to another page。
get_title($primid ) istheidofaspecificelementin $ galerry page。
andthemechanismworksfineuntiloneoftheelementsidhasasinglequoteinit.whichmakessenseasitwouldinterrupttheeechofunction。
thisiswhyihavetheapastrofunction :
functionAPastro($phrase ) {
$phrase1=str_replace ()优质啤酒、''、$phrase );
return $phrase1;
}
yet thebeforethesinglequoteisn ' t helping .
soletssaythelinkredirectstotheelementwithid=' l ' aro ' onthepagesomething.PHP
thentheurlwillbesomething.PHP # l淡笔/pitwouldinterrupttheechofunction
itwouldn ' t.itwouldbreakastringliteraldelimitedby ' characters,butyourstringliteralisdelimitedwith ' characters.in
useurlencodetomakeastringsafetoputintoaurl。
usehtmlspecialcharstomakeastringsafetoputintoanhtmlattribute。
$title=get_title($primid );
$ URL safe _ title=urlencode ($ title;
$ URL=$ galerry.' # '.$ URL safe _ title;
$ html safe _ URL=htmlspecialchars ($ URL,kkdxbcQUOTES | kkdxbcHTML5);
echo 'voir sa galerie ';