簡體   English   中英

成員函數,當調用結果為嚴重錯誤時,調用php中未定義的函數

[英]member function when called result into Fatal error Call to undefined function in php

我有一堂課

<?php
include 'mysql.php';
include '/XXXXXXXXXXX/web/settings/funciones.php';

class processXML
{
var $idFeed;
var $idPais;
var $suf,$pref;
var $lastCode;
var $curCode;
var $localDb ;
var $remoteDb ;
var $imagenTag; 
var $palntilla;

  function processXML($x, $y)
  {
      $his->idFeed = $x;
      $this->idPais=$y;
      $this->localDb = new dataBase();


  }

 function setLC()
 {
     $sql = "SELECT max(id) as ID,feed , idpropiedad FROM `registrofeed` WHERE feed=".$his->idFeed."";
     $result = $this->localDb->execute($sql);
     $row=mysql_fetch_array($result);
     $this->lastCode = $row['idpropiedad'];
 }

 function setImageTag()
 {
     $this->palntilla = returnPlantilla($his->idFeed); 

    $result = $this->localDb->execute("select infopropiedades from propiedadesPlantilla where palntilla=".$this->palntilla."");

    $row=mysql_fetch_array($result);
    $propiedadesColumn = explode("[;;]",$row["infopropiedades"]);

    foreach($propiedadesColumn as $val)
    {
       $x= explode("=",$val);   
       if(trim($x[0])=="Fotos" or trim($x[0])=="fotos")
       {
         $this->imagenTag = trim($x[1]);   
       }

    }

 }

 function printVars()
 {
     setLC();
     setImageTag();

     echo "idFeed=".$this->idFeed."<br>";
     echo "idPais=".$this->idPais."<br>";
     echo "imgTag=".$this->imagenTag."<br>";
     echo "lastCode=".$this->lastCode."<br>";    
 }



}

然后我這樣叫課

$obj = new processXML(20,4);
$obj->printVars();

我收到一個致命錯誤

Fatal error: Call to undefined function setLC() in 

知道為什么

提前致謝

您正在調用類方法,因此您需要:

$this->setLC();
$this->setImageTag();

// etc.
$this->setLC();
$this->setImageTag();

還解決此問題:

$ this-> idFeed = $ x; 而不是$ his-> idFeed = $ x; //在processXML函數中

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM