[英]Looping through Different Arrays
I've got an array called namely 我有一个名为的数组
externalArray
externalArrayIgnored
and 和
rowname
In externalArray
is a bunch of links stored. 在
externalArray
中存储了一堆链接。 In rowname
the links stored have the same Domain with externalArray
. rowname
,存储的链接与externalArray
具有相同的Domain。 The ones stored in rowname
got marked up in the Webinterface
with a glyphicon
. 存储在
rowname
的那些已在Webinterface
使用Webinterface
进行了glyphicon
。 If you click this, the entry in externalArrayIgnored
will be store in the database. 如果单击此按钮,则
externalArrayIgnored
的条目将存储在数据库中。
So if I got a link which is in rowname
and not in externalArrayIgnored
it should execute this: 所以,如果我有一个链接,是
rowname
而不是externalArrayIgnored
应该执行这样的:
echo "<span class='external_glyphicon glyphicon glyphicon-ok-sign' style='color: #5cb85c;' data-id='$row->id' data-rowname='$row->name' data-url='$link' data-key='1'></span>";
If it is in rowname
and in externalArrayIgnored
nothing should happen. 如果它
rowname
和externalArrayIgnored
不会发生任何情况。 That is my code right now,but it is not working: 那是我现在的代码,但是没有用:
<?php foreach ($externalArray as $key => $link): ?>
<a href="<?php echo $link; ?>" target="_blank"><?php echo $link; ?> </a>
<?php endforeach;?>
<?php
foreach ($rowname as $markedUrl){
if($markedUrl == cut_url($link) && in_array($link, $externalArrayIgnored)){
echo "<span class='external_glyphicon glyphicon glyphicon-ok-sign' style='color: #5cb85c;' data-id='$row->id' data-rowname='$row->name' data-url='$link' data-key='1'></span>";
}
}
?>
How can I loop this right ? 我该如何循环呢? Thanks for any help.
谢谢你的帮助。
I figured it out for myself: 我自己弄清楚了:
Thats the Solution: 那就是解决方案:
foreach ($externalArray as $key => $link): ?>
<a href="<?php echo $link; ?>" target="_blank"><?php echo $link; ?> </a> <?php
if( in_array(cut_url($link), $rowname) && !in_array($link, $externalArrayIgnored)){
echo "<span class='external_glyphicon glyphicon glyphicon-ok-sign' style='color: #5cb85c;' data-id='$row->id' data-rowname='$row->name' data-url='$link' data-key='1'></span>";
}
?><br>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.