我将此代码尝试到 localhost 并且它运行良好,但是当我将它上传到服务器时它不起作用并且它有这一行的问题:if($key[$j]== $this->test);
. 你能帮我吗 ?:)
<?php
class key {
public $test;
public $result;
public $imp;
public $sentc;
function __construct() {
$this->test = $_GET['c'];
$arr = explode("-", $this->test);
$p = PRODUCTS::getallteedrow();
$tproduct = PRODUCTS::getAlltaeed();
$ii = 0;
for ($i = 0; $i < $p; $i++) {
$pp = $tproduct[$i];
$key = $pp['keyword'];
$key = explode(',', $key);
$count = count($key);
for ($j = 0; $j < $count; $j++) {
if ($key[$j] == $this->test) {
$this->result[$ii] = PRODUCTS::products_SelectRow($pp['id']);
$this->sentc = $this->result[$ii]['description'];
$this->sentc = explode(" ", $this->sentc);
if (count($this->sentc) >= 30) {
$this->sentc = array_slice($this->sentc, 0, 30);
$this->sentc = implode(" ", $this->sentc);
$this->result[$ii]['description'] = $this->sentc . ".....";
}
echo $this->result[$ii]['description'];
$ii++;
}
}
}
}
}
?>
它是 PHP 代码,我在 PHP MVC 中工作。