【发布时间】:2014-03-13 13:24:27
【问题描述】:
我有以下...
<a href='Count.php?count=Red'><
但是我要怎么做才能让它不止一种颜色呢?
<a href='Count.php?count=Red, Green, Blue'><
没有用,也没有用 && 替换 , 有什么想法吗?
这是执行计数的 PHP 代码:
<?php
$lineNumber=0;
$handle = fopen('shapeStorage.txt', 'r');
if ($handle)
{
while (($line = fgets($handle))!== false)
{
$lines[$lineNumber] = $line;
$lineNumber++;
}
}
else
{
echo 'error, error, high voltage';
}
for($n=0; $n<sizeof($lines); $n++)
{
if(strstr($lines[$n], $_GET["count"])) $colourCount++;
}
echo '<h2>There are '.$colourCount.' '.$_GET["count"].' shape(s) stored within the site.</h2>';
?>
【问题讨论】:
-
您是否要计算每种颜色出现的次数或颜色的数量?
-
它在一个文本文件中出现了多少次。
-
你的意思是要计算每个单词在文件中出现的次数?
-
那么href的作用是什么?是指定要计数的颜色吗?
-
因为它需要它到另一个页面来告诉你有多少他们是特定颜色的......我会在 php 方面发布
标签: php url count query-string