How to insert filename php value into javascript?
Hello i got code where i put my images in array
<?php
foreach (array_merge(glob("NU/*.[jJ][pP][gG]"),glob("NU/*.[pP][nN][gG]"),glob("NU/*.[jJ][pP][eE][gG]"),glob("NU/开发者_运维知识库*.[gG][iI][fF]")) as $filename) {
}
?>
and i got javascript where i must use this $filename! how can i put this value in javascript operations? some example would be welcome and appreciated ;)
<?php
print "<script type=text/javascript>var foo=$foo</script>";
?>
All the usual caveats about the safety of code injection and string escaping apply.
精彩评论