对非对象调用成员函数??php新手
这将是一个愚蠢的错误。 我得到上面的错误。基本当用户单击一个链接时,它会打开一个视图页面,该页面调用这个需要$category的类对非对象调用成员函数??php新手,php,Php,这将是一个愚蠢的错误。 我得到上面的错误。基本当用户单击一个链接时,它会打开一个视图页面,该页面调用这个需要$category的类 <?php // Initialise the template require_once "/var/www/template/template.php"; $template = new CHTemplate(); // And create a cid object require_once "/var/www/Co
<?php
// Initialise the template
require_once "/var/www/template/template.php";
$template = new CHTemplate();
// And create a cid object
require_once "/var/www/Component/DisplayWIPOnLocation.php";
$WIPProgress= new CHWIPProgress();
if(isset($_GET['category'])){
$content .= " <h3> Details for Component : $reference </h3> ";
$bundle = $WIPProgres->GetProducts($_GET['category']);
$reference = $_GET['category'];
// Now show the details
foreach($bundle as $x){
$content .= "
<table>
<tr><th> ProductNumber</th><td>" . $x['ProductNumber'] . "</td>
</tr>
<tr><th> Description </th><td>" . $x['Description'] . "</td></tr>
</table>
<br>";
}
}
$template->SetTag("content", $content);
echo $template->Display();
?>
这只是意味着你的一个对象,你认为是一个对象,不是 例如:
$bundle = $WIPProgres->GetProducts($_GET['category']); //<< you left off an `s`
$bundle=$WIPProgres->GetProducts($\u GET['category'])// 打字错误:
e、 g.您正在调用一个不存在的对象。这个错误具体出现在哪里?哪一行?第18行这一行$bundle=$WIPProgres->GetProducts($\u GET['category'])$WIPProgres->GetProducts
-您错过了WIPProgress
中的最后一个s
,我更正了输入错误。。。获取此消息时仍然调用未定义的方法CHWIPProgress::GetProducts()omg,我是个白痴。正在复制旧的类文件,而不是最新的类文件。
$bundle = $WIPProgres->GetProducts($_GET['category']); //<< you left off an `s`
$WIPProgress= new CHWIPProgress();
^^--- two s's
$bundle = $WIPProgres->GetProducts($_GET['category']);
^--- one S