Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用代码点火器调用未定义的方法Verifybuyback::basic()_Php_Codeigniter - Fatal编程技术网

Php 使用代码点火器调用未定义的方法Verifybuyback::basic()

Php 使用代码点火器调用未定义的方法Verifybuyback::basic(),php,codeigniter,Php,Codeigniter,我已经阅读了所有的帖子,我可以找到这样,没有一个可以解决我的问题。我得到以下错误: Call to undefined method Verifybuyback::basic() in /chroot/home/bookcell/bookcellaronline.com/html/CodeIgniter/application/controllers/verifybuyback.php on line 38 这是我的Verifybuyback控制器: if ( ! defined('B

我已经阅读了所有的帖子,我可以找到这样,没有一个可以解决我的问题。我得到以下错误:

Call to undefined method Verifybuyback::basic() in /chroot/home/bookcell/bookcellaronline.com/html/CodeIgniter/application/controllers/verifybuyback.php on line 38
这是我的Verifybuyback控制器:

    if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Verifybuyback extends CI_Controller {
     function __construct()
{
    parent::__construct();
    $this->load->model('amz','',TRUE);
    $this->load->helper('amazon');
}

function title()
{
    $this->load->library('form_validation');

    $this->form_validation->set_rules('isbn', 'ISBN','trim|required|xss_clean|callback_title_check' );

if($this->form_validation->run('title')==FALSE)
{
    //Field validation failed.  User redirected to login page
 $this->load->view('buybackmws');

}
else
{
    //GOTO RESTRICTED AREAS
    redirect('buybackmws', 'refresh');
}
}

function title_check()
{
    //Field validation succeeded.  Validate against database
    $isbn=$this->input->post('isbn');

    //QUERY AMAZON FOR THE INFORMATION

    $this->basic($isbn); //THIS IS THE LINE WITH THE ERROR!!!!

    if($result)
    {
        $sess_array=array();
        foreach($result as $row)
        {
            $sess_array=array(
                'title'=>$row->title,

            );
我的amazon_helper.php是:

if ( ! defined('BASEPATH')) exit('No direct script access allowed');

if (!function_exists('basic')){

function basic($isbn){

    $CI = & get_instance();
$CI->load->model('amz','',TRUE);
    $parsed_xml=$CI->amz->amazon_xml($isbn);

     if($parsed_xml)
    {
        $amazonResult = array();
$itemCondition = "any";

$current = $parsed_xml->GetMatchingProductForIdResult->Products->Product;//ListMatchingProductsResult


    if(isset($parsed_xml->GetMatchingProductForIdResult->Products, $current, $current->AttributeSets)) {
        //foreach($current as $offer1){
          $offer1=$current;
            if(stristr($offer1->AttributeSets->children('ns2', true)->ItemAttributes->Author, "Cram101") != true &&
               stristr($offer1->AttributeSets->children('ns2', true)->ItemAttributes->ProductGroup, "Book") == true &&
               stristr($offer1->AttributeSets->children('ns2', true)->ItemAttributes->Format, "Kindle eBook") != true)
               {
        $asin = $offer1->Identifiers->MarketplaceASIN->ASIN;
        $amazonResult = array(
            'Title' => $offer1->AttributeSets->children('ns2', true)->ItemAttributes->Title,
            'SalesRank' => $offer1->SalesRankings->SalesRank->Rank,
            'Binding' => $offer1->AttributeSets->children('ns2', true)->ItemAttributes->Binding,
            'Weight' => ($offer1->AttributeSets->children('ns2', true)->ItemAttributes->ItemDimensions->Weight),
            'ListPrice' => $offer1->AttributeSets->children('ns2', true)->ItemAttributes->ListPrice->Amount,
            'ImageURL' => str_replace('SL75','SL200',$offer1->AttributeSets->children('ns2', true)->ItemAttributes->SmallImage->URL),
            'DetailURL' => ("http://www.amazon.com/gp/product/" . $asin),//$current->AttributeSets->children('ns2', true)->ItemAttributes->SmallImage->URL,

            );

        } // end of if
                    $CI->session->set_userdata('amazon',$amazonResult);
            } // END OF ISSET
            return TRUE;

    }else {

        return false;
    }

}  //END OF AMAZON FUNCTION
}
我的amz型号是:

function amazon_xml($searchTerm) {

$params = array(
    'AWSAccessKeyId' => $AWS_ACCESS_KEY_ID,
    'Action' => "GetMatchingProductForId",
    'SellerId' => $MERCHANT_ID,
    'SignatureMethod' => "HmacSHA256",
    'SignatureVersion' => "2",
    'Timestamp'=> gmdate("Y-m-d\TH:i:s.\\0\\0\\0\\Z", time()),
    'Version'=> "2011-10-01",
    'MarketplaceId' => $MARKETPLACE_ID,
    'IdType' => "ISBN",
    'IdList.Id.1'=> $searchTerm
    );      


// Sort the URL parameters
$url_parts = array();
foreach(array_keys($params) as $key)
    $url_parts[] = $key . "=" . str_replace('%7E', '~', rawurlencode($params[$key]));
sort($url_parts);

// Construct the string to sign
$url_string = implode("&", $url_parts);
$string_to_sign = "GET\nmws.amazonservices.com\n/Products/2011-10-01\n" . $url_string;

// Sign the request
$signature = hash_hmac("sha256", $string_to_sign,$AWS_SECRET_ACCESS_KEY, TRUE);

// Base64 encode the signature and make it URL safe
$signature = urlencode(base64_encode($signature));

$url = "https://mws.amazonservices.com/Products/2011-10-01" . '?' . $url_string . "&Signature=" . $signature;


$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
$response = curl_exec($ch);

    $parsed_xml = simplexml_load_string($response);

return ($parsed_xml);
} //END OF AMAZON_XML FUNCTION
} // END OF CLASS

我更改了函数的名称,认为它可能与模型太相似(它以前是amz_basic,我将其更改为basic)。我甚至试着把load->helper(amazon)放在错误行的前面,但没有帮助。我做错了什么?

你可以直接调用
basic($isbn)我的意思是没有
$this
。如果帮助器函数不属于帮助器文件中的类,则可以在不使用
$this
的情况下调用该帮助器函数