<?php
$str = '苹果很好吃。';
$str = str_replace("苹果",'香蕉',$str);
echo $str."<br>";
//请将变量$str中的苹果替换成香蕉
?>
<script>
var str = "苹果很好吃。";
str = str.replace("苹果","香蕉")+"<br>";
document.write(str);
</script>
$str = '苹果很好吃。';
$str = str_replace("苹果",'香蕉',$str);
echo $str."<br>";
//请将变量$str中的苹果替换成香蕉
?>
<script>
var str = "苹果很好吃。";
str = str.replace("苹果","香蕉")+"<br>";
document.write(str);
</script>
2017-02-27
<?php
$fruit = array('苹果','香蕉','菠萝');
foreach($fruit as $key=>$value){
echo '<br>第'.$key.'值是:'.$value;
}
?>
<script>
var arr = [1,2,3,4];
arr.forEach(function(value,index,array){
document.write(value);
})
</script>
$fruit = array('苹果','香蕉','菠萝');
foreach($fruit as $key=>$value){
echo '<br>第'.$key.'值是:'.$value;
}
?>
<script>
var arr = [1,2,3,4];
arr.forEach(function(value,index,array){
document.write(value);
})
</script>
2017-02-27