2012-04-24 12 views
0

が、私は今、10時間に近付いためにこれで戦ってきたし、どこにも持っていない...表示正しいデータ

私のクライアントは、彼らのSEOによってオーバーネジ止めされています私は彼らのビジネスを救うために手伝っています。 Googleの主要な問題の1つは、ウェブサイトのコンテンツが、SEOコンパニオンのウェブサイトでホストされているデータフィードに依存していることです。主要都市周辺のさまざまな地域のコンテンツは、このスクリプトによって自動生成されます。スクリプトの一部はクライアントサーバー上でホストされ、これはフィードと通信します。

フィードで使用するすべてのデータを含むJSONファイルが見つかりましたが、代わりにこのファイルを読み込むためにスクリプトを取得するのが苦労しています。

generateContentFromFeedとgenerateTextFromFileに興味があるはずの2つの関数があるようです。現在のところ、generateContentFromFeedを使用しているようです(しかし、generateTextFromFile elsehwereを使用している可能性がありますが、私はそれがisntであると確信しています。

私は周りの機能を交換し、設定ファイルのフィードのソースを変更しようとしましたが、喜びはありませんでした。これにより、jsonファイルの内容全体が出力されました。

ファイルは以下の通りである:

content.class.php

<?php 

/** 
* This class manipulates content from files/JSON into an array 
* Also includes helpful functions for formatting content 
*/ 

class Content { 

public $links = array(); 
public $replacements = array(); 

private function stripslashes_gpc($string) { 

    if (get_magic_quotes_gpc()) { 

     return stripslashes($string); 

    } else { 

     return $string; 

    } 

} 

private function sourceContentToArray($source) { 

    // array 
    if (is_array($source)) { 

     $array = $source; 

    // json 
    } elseif (json_decode($source) != FALSE || json_decode($source) != NULL) { 

     $array = json_decode($source, 1); 

    // file 
    } elseif (file_exists($source)) { 

     if (!$array = json_decode(file_get_contents($source), 1)) { 

      echo "File empty or corrupt"; 
      return false; 

     } 

    } else { 

     echo 'Source content not recognised'; 
     return false; 

    } 

    return $array; 

} 

public function generateContent($source, $type="paragraph", $label="", $subject, $num=0, $randomize_order=false) { 

    if (!$array = $this->sourceContentToArray($source)) 
     return false; 

    $array = empty($this->links) ? $this->loadLinks($array, $subject) : $array; 
    $this->loadGlobalReplacements($array, $subject); 

    $ca = array(); 
    foreach ($array['content'] as $c) { 

     if ($c['type'] == $type) { 

      if (empty($label) || (!empty($label) && $c['label'] == $label)) { 

       $ca[] = $c; 

      } 

     } 

    } 

    $rc = array(); 
    foreach ($ca as $k => $a) { 

     $rc[] = $this->randomizeContent($a, $subject.$k); 

    } 

    if ((!is_array($num) && $num >= 1) || (is_array($num) && $num[0] >= 1)) { 

     $rc = $this->arraySliceByInteger($rc, $subject, $num); 

    } else if ((!is_array($num) && $num > 0 && $num < 1) || (is_array($num) && $num[0] > 0 && $num[0] < 1)) { 

     $rc = $this->arraySliceByPercentage($rc, $subject, $num); 

    } else { 

     if ($randomize_order == true) 
      $rc = $this->arraySliceByPercentage($rc, $subject, 1); 

    } 

    return $rc; 

} 

public function formatContent($source, $type, $subject, $find_replace=array()) { 

    $c = ""; 

    foreach ($source as $k => $s) { 

     $text = ""; 
     if ($type == "list" || $type == "paragraph") { 

      $text .= "<h3>"; 
      foreach ($s['title'] as $t) { 

       $text .= $t." "; 

      } 
      $text .= "</h3>"; 

     } 

     if ($type == "list") { 

      $text .= "<ul>"; 

     } else if ($type == "paragraph") { 

      $text .= "<p>"; 

     } 

     foreach ($s['parts'] as $b) { 

      if ($type == "list") 
       $text .= "<li>"; 

      $text .= $b." "; 

      if ($type == "list") 
       $text .= "</li>"; 

     } 

     if ($type == "list") { 

      $text .= "</ul>"; 

     } else if ($type == "paragraph") { 

      $text .= "</p>"; 

     } 

     $text = $this->findReplace($s['replacements'], $text, $subject.$k."1"); 
     $text = $this->injectLinks($this->links, $text, $subject.$k."2"); 
     $text = $this->findReplace($this->replacements, $text, $subject.$k."3"); 
     $text = $this->findReplace($find_replace, $text, $subject.$k."4"); 
     $text = $this->aAnReplacement($text); 
     $text = $this->capitaliseFirstLetterOfSentences($text); 

     $c .= $this->stripslashes_gpc($text); 

    } 

    return $c; 

} 

public function injectLinks($links, $text, $subject) { 

    global $randomizer; 

    if (empty($links)) 
     return $text; 

    foreach ($links as $k => $link) { 

     $_link = array(); 
     if (preg_match("/\{L".($k+1)."\}/", $text)) { 

      preg_match_all("/\{L".($k+1)."\}/", $text, $vars); 

      foreach ($vars[0] as $vark => $varv) { 

       $_link['link'] = empty($_link['link']) ? $this->links[$k]['link'] : $_link['link']; 
       $l_link = $randomizer->fetchEncryptedRandomPhrase($_link['link'], 1, $subject.$k.$vark); 
       unset($_link['link'][array_search($l_link, $_link['link'])]); 
       $_link['link'] = array_values($_link['link']); 

       $_link['text'] = empty($_link['text']) ? $this->links[$k]['text'] : $_link['text']; 
       $l_text = $randomizer->fetchEncryptedRandomPhrase($_link['text'], 2, $subject.$k.$vark); 
       unset($_link['text'][array_search($l_text, $_link['text'])]); 
       $_link['text'] = array_values($_link['text']); 

       $link_html = empty($l_link) ? $l_text : "<a href=\"".$l_link."\">".$l_text."</a>"; 
       $text = preg_replace("/\{L".($k+1)."\}/", $link_html, $text, 1); 
       $this->removeUsedLinksFromPool($l_link); 

      } 

     } 

    } 

    return $text; 

} 

private function loadLinks($source, $subject) { 

    global $randomizer; 

    if (!empty($source['links'])) { 

     foreach ($source['links'] as $k => $l) { 

      $source['links'][$k]['link'] = preg_split("/\r?\n/", trim($l['link'])); 
      $source['links'][$k]['text'] = preg_split("/\r?\n/", trim($l['text'])); 

     } 

     $this->links = $source['links']; 

    } 

    return $source; 

} 

private function loadGlobalReplacements($source, $subject) { 

    global $randomizer; 

    $source['replacements'] = $this->removeEmptyIndexes($source['replacements']); 
    foreach ($source['replacements'] as $k => $l) { 

     $source['replacements'][$k] = preg_split("/\r?\n/", trim($l)); 

    } 

    $this->replacements = $source['replacements']; 
    return $source; 

} 

private function removeUsedLinksFromPool($link) { 

    foreach ($this->links as $key => $links) { 

     foreach ($links['link'] as $k => $l) { 

      if ($l == $link) { 

       unset($this->links[$key]['link'][$k]); 

      } 

     } 

    } 

} 

private function randomizeContent($source, $subject) { 

    global $randomizer; 

    $source['title'] = $this->removeEmptyIndexes($source['title']); 
    foreach ($source['title'] as $k => $t) { 

     $source['title'][$k] = trim($randomizer->fetchEncryptedRandomPhrase(preg_split("/\r?\n/", trim($t)), 1, $subject.$k)); 

    } 

    $source['parts'] = $this->removeEmptyIndexes($source['parts']); 
    foreach ($source['parts'] as $k => $b) { 

     $source['parts'][$k] = trim($randomizer->fetchEncryptedRandomPhrase(preg_split("/\r?\n/", trim($b)), 2, $subject.$k)); 

    } 


    $source['structure'] = trim($source['structure']); 
    if ($source['type'] == "list") { 

     $source['parts'] = array_values($source['parts']); 
     $source['parts'] = $randomizer->randomShuffle($source['parts'], $subject."9"); 

    } else if ($source['structure'] != "") { 

     $source['structure'] = $randomizer->fetchEncryptedRandomPhrase(preg_split("/\r?\n/", $source['structure']), 3, $subject); 
     preg_match_all("/(\{[0-9]{1,2}\})/", $source['structure'], $matches); 

     $sc = array(); 
     foreach ($matches[0] as $match) { 

      $sc[] = str_replace(array("{", "}"), "", $match); 

     } 

     $bs = array(); 
     foreach ($sc as $s) { 

      $bs[] = $source['parts'][$s]; 

     } 

     $source['parts'] = $bs; 

    } 

    $source['replacements'] = $this->removeEmptyIndexes($source['replacements']); 
    foreach ($source['replacements'] as $k => $r) { 

     $source['replacements'][$k] = preg_split("/\r?\n/", trim($r)); 

    } 

    return $source; 

} 

private function removeEmptyIndexes($array, $reset_keys=false) { 

    foreach($array as $key => $value) { 

     if ($value == "") { 

      unset($array[$key]); 

     } 

    } 

    if (!empty($reset_keys)) 
     $array = array_values($array); 

    return $array; 

} 

private function arraySliceByPercentage($array, $subject, $decimal=0.6) { 

    global $randomizer; 

    $array = $randomizer->randomShuffle($array, $subject); 

    if (is_array($decimal)) 
     $decimal = $randomizer->fetchEncryptedRandomPhrase(range($decimal[0], $decimal[1], 0.1), 1, $subject); 

    $ac = count($array); 
    $n = ceil($ac * $decimal); 

    $new_array = array_slice($array, 0, $n); 

    return $new_array; 

} 

private function arraySliceByInteger($array, $subject, $number=10) { 

    global $randomizer; 

    $array = $randomizer->randomShuffle($array, $subject); 

    if (is_array($number)) 
     $number = $randomizer->fetchEncryptedRandomPhrase(range($number[0], $number[1]), 1, $subject); 

    $new_array = array_slice($array, 0, $number); 

    return $new_array; 

} 

private function aAnReplacement($text) { 

    $irregular = array(

     "hour"  => "an", 
     "europe" => "a", 
     "unique" => "a", 
     "honest" => "an", 
     "one"  => "a" 

    ); 

    $text = preg_replace("/(^|\W)([aA])n ([^aAeEiIoOuU])/", "$1$2"." "."$3", $text); 
    $text = preg_replace("/(^|\W)([aA]) ([aAeEiIoOuU])/", "$1$2"."n "."$3", $text); 

    foreach ($irregular as $k => $v) { 

     if (preg_match("/(^|\W)an? ".$k."/i", $text)) { 

      $text = preg_replace("/(^|\W)an? (".$k.")/i", "$1".$v." "."$2", $text); 

     } 

    } 

    return $text; 

} 

private function capitaliseFirstLetterOfSentences($text) { 

    $text = preg_replace("/(<p>|<li>|^|[\n\t]|[\.\?\!]+\s)(<a.*?>)?(?!%)([a-z]{1})/se", "'$1$2'.strtoupper('$3')", $text); 
    return $text; 

} 

public function findReplace($find_replace, $input, $subject) { 

    global $randomizer; 
    if (!empty($find_replace)) { 

     foreach ($find_replace as $key => $val) { 

      if (is_array($val)) { 

       $fr = $val; 
       $pattern = "/".preg_quote($key)."/i"; 
       preg_match_all($pattern, $input, $vars); 

       foreach ($vars[0] as $vark => $varv) { 

        $fr = empty($fr) ? $val : $fr; 
        $new_val = $randomizer->fetchEncryptedRandomPhrase($fr, 1, $subject.$key.$vark); 
        unset($fr[array_search($new_val, $fr)]); 
        $fr = array_values($fr); 

        $input = preg_replace($pattern, $new_val, $input, 1); 

       } 

      } else { 

       $pattern = "/".preg_quote($key)."/i"; 
       $input = preg_replace($pattern, $val, $input); 

      } 

     } 

    } 

    return $input; 

} 

public function generateTextFromFile($file, $subject, $find_replace=array()) { 

    global $randomizer; 

    $content = trim(file_get_contents($file)); 
    $lines = preg_split("/\r?\n/s", $content); 

    $text = $randomizer->fetchEncryptedRandomPhrase($lines, 4, $subject); 
    $text = $this->findReplace($find_replace, $text, $subject); 

    return $text; 

} 

public function generateContentFromFeed($file, $type, $label="", $subject, $num=0, $find_replace=array()) { 

    global $cfg; 

    $vars = array ("api_key"  => $cfg['feed']['api_key'], 
        "subject"  => $subject, 
        "file"   => $file, 
        "type"   => $type, 
        "label"   => $label, 
        "num"   => $num, 
        "find_replace" => json_encode($find_replace)); 

    $encoded_vars = http_build_query($vars); 

    $ch = curl_init(); 
    curl_setopt($ch, CURLOPT_URL,"http://feeds.redsauce.com/example/index.php"); 
    curl_setopt($ch, CURLOPT_POST, 1); 
    curl_setopt($ch, CURLOPT_POSTFIELDS, $encoded_vars); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 

    $content = curl_exec($ch); 

    curl_close($ch); 

    return $content; 

} 

} 

?> 

のconfig.php

<?php 

// LOCAL SERVER 
// Paths 
$cfg['basedir'] = "public_html/directory/"; // change this for inlcudes and requires. 
$cfg['baseurl'] = "/directory/"; // change this for relative links and linking to images, media etc. 
$cfg['fullbaseurl'] = "http://customerssite.com/directory/"; // change this for absolute links and linking to pages 

/* 
// Database - local 
$cfg['database']['host'] = "127.0.0.1"; 
$cfg['database']['name'] = "username"; 
$cfg['database']['user'] = 'root'; // change this to the database user 
$cfg['database']['password'] = ''; // change this to the database password 
*/ 

// Database - web 
$cfg['database']['host'] = "localhost"; 
$cfg['database']['name'] = "db"; 
$cfg['database']['user'] = 'user'; // change this to the database user 
$cfg['database']['password'] = 'pass'; // change this to the database password 

// Errors 
$cfg['errors']['display'] = 1; // change this to display errors on or off (on for testing, off for production) 
$cfg['errors']['log'] = 0; // change this to log errors to /log/error.log 

// Caching 
$cfg['caching']['status'] = 0; // determines whether the cache is enabled. 1 for enabled, 0 for disabled 
$cfg['caching']['expiry_time'] = 604800; // determines expiry time of cached items (604800 = 14 days) 
$cfg['caching']['directory'] = $cfg['basedir']."public_html/_cache/"; // directory in which cached files are stored 

// Analytics 
$cfg['analytics']['status'] = 1; 
$cfg['analytics']['tracking_id'] = "UA-21030138-1"; 

// Javascript 
$cfg['maps']['status'] = 0; // load google maps javascript 
$cfg['jquery_ui']['status'] = 0; // load jquery ui javascript + css 

// Site defaults 
$cfg['site_name'] = "Customer"; // change this to the site name 
$cfg['default']['page_title'] = "Customer"; // change this to the default title of all pages 
$cfg['default']['page_description'] = "Customer"; // change this to the default meta-description of all pages 
$cfg['default']['email'] = "Customer"; // change this to the administrators email for receiving messages when users signup etc 
$cfg['default']['category']['id'] = 130; 

// Email 
$cfg['email']['address'] = "Customer"; // change this to the administrators email for receiving messages when users signup etc 
$cfg['email']['from'] = $cfg['site_name']." <Customer>"; // email will appear to have come from this address 
$cfg['email']['subject'] = "Enquiry from ".$cfg['site_name']; // subject of the email 
$cfg['email']['success_message'] = "Thank you for your enquiry. Someone will be in touch with you shortly."; // message to display if the email is sent successfully 
$cfg['email']['failure_message'] = "There was an error processing your enquiry. <a href=\"".$_SERVER['REQUEST_URI']."\">Please try again</a>."; // message to display if the email is not sent successfully 

// Content feed 
$cfg['feed']['api_key'] = "Customer"; // enter the unique content feed api key here 
$cfg['feed']['url'] = "http://feeds.customersseocompany.com/customer/index.php"; // URL to connect to to pull the content feed 

// Dates 
date_default_timezone_set('Europe/London'); 
$cfg['default']['date_format'] = "d/m/Y H:i:s"; 

// Options 
$cfg['listings']['type'] = "ajax"; // options are none (to display no listings), page (to display the listings on the page) or ajax (to load the listings via AJAX) 
$cfg['listings']['num_per_page'] = 10; // maximum number of listings to show per page 

// Routing 
$cfg['routes'] = array(

'category' => array(

    "(?P<category>.+?)-category", 
    "_pages/category.php" 

), 


't1' => array(

    "(?P<category>.+?)-in-(?P<t1_name>.+?)_(?P<county>.+)", 
    "_pages/tier1.php" 

), 

't1_map' => array(

    "t1-map-data-(?P<t1_name>.+)-(?P<page_num>[0-9]+)", 
    "_ajax/map-data.php" 

), 

't2_map' => array(

    "t2-map-data-(?P<t2_name>.+)-(?P<t1_name>.+)-(?P<page_num>[0-9]+)", 
    "_ajax/map-data.php" 

), 

'ajax_listings' => array(

    "ajax-listings-(?P<category>.+?)-(?P<t2_id>.+)-(?P<page_num>[0-9]+)", 
    "_ajax/listings.php" 

), 

'search' => array(

    "^search\/?$", 
    "_pages/search.php" 

), 

'single' => array(

    ".*?-(?P<listing_id>[0-9]+)", 
    "_pages/single.php" 

) 

); 

// Site specific 


// Encoding 
header('Content-type: text/html; charset=UTF-8'); 

?> 

tier1.php(各位置を生成するために使用されるファイルで使用されるコードの一部およびキーワードページ)。

<?php 

$randParas = array(1, 2, 3); 

$numParas = $randomizer -> fetchEncryptedRandomPhrase($randParas, 1, $_SERVER['REQUEST_URI']); 

$content = $content->generateContentFromFeed(

// file 
"categories/".$category[0]['category_slug']."/paragraphs", 

// type 
"paragraph", 

// label 
"", 

// subject 
$_SERVER['REQUEST_URI']."7", 

// num 
$numParas, 

// find_ replace 
array(

    "XX" => $t1_location[0]['definitive_name'], 
    "YY" => $cfg['site_name'] 

) 


); 


?> 

JSONファイルの1からの抜粋(私は私が貼り付けられているコードは、早期終了承知しています、私はちょうど、ファイルが巨大であるとして、ここではその一部を入れたかった!):

{"filename":" xx keywords","content":[{"title":{"1":"xx example\r\nexample in xx\r\nexample in the xx region\r\nexample in the xx area","2":"","3":"","4":""},"type":"paragraph","label":"","structure":"","parts":{"1":"Stylish and practical, a xx keyword \r\nPractical and stylish, a xx keyword \r\nUseful and pragmatic, a xx keyword \r\nPragmatic and useful, a xx keyword \r\nModern and convenient, a xx keyword ", 

あなたが必要な場合それ以上の情報は、あなたが必要なものを教えてください。私は本当にこのクライアントを助けたいと思っているので、事前に助けていただきありがとうございます。彼らは否定的なSEO会社に襲われてはいけない偉大な人々です。

誰かがこのスクリプトが何であるか知っているなら、最も有用なのは何ですか?私はそれを購入/ダウンロードし、データを使用して自分のフィードを生成することができます。

フィードを生成するコードや、jsonファイルからデータを取り出して正しくフィルタリングする方法についてお手伝いできれば、それは素晴らしいことです。

多くのおかげで、

ケビン

PS。すべてのコードを申し訳ありません、私は十分に投稿していないために前に伝えられています!

EDIT:

<?php 

$randParas = array(1, 2, 3); 

$numParas = $randomizer -> fetchEncryptedRandomPhrase($randParas, 1, $_SERVER['REQUEST_URI']); 

$content = $content->generateContent(

// file 
"content/categories/".$category[0]['category_slug']."/paragraphs.json", 

// type 
"paragraph", 

// label 
"", 

// subject 
$_SERVER['REQUEST_URI']."7", 

// num 
$numParas, 

// find_ replace 
array(

    "XX" => $t1_location[0]['definitive_name'], 
    "YY" => $cfg['site_name'] 

) 


); 



?> 

     <?php 

      if($numParas == '3'){ 

       $divClass = 'vertiCol'; 

      } 

      elseif($numParas == '2'){ 

       $divClass = 'vertiColDub'; 

      } 

      else { 

       $divClass = 'horizCol'; 

      } 

      $randImages = glob('_images/categories/'.$category[0]['category_slug'].'/*.jpg'); 
      $randImages = $randomizer->randomShuffle($randImages, $_SERVER['REQUEST_URI']); 

       $fc = preg_replace("/<h3>.*?<\/h3>/", "$0", $content);    
       $fc = preg_replace("/<h3>.*?<\/h3><p>.*?<\/p>/", "<div class=\"contCol ".$divClass."\">$0$1</div>", $content); 

      $fca = preg_split("/(\.|\?|\!)/", $fc, -1, PREG_SPLIT_DELIM_CAPTURE); 

      $prStr = ''; 

      foreach ($fca as $fck => $fcv) { 

       if ($fck % 3 == 0 && $fck != 0 && !in_array($fcv, array(".", "?", "!"))) 
        $prStr .= "</p>\n<p>"; 

        $prStr .= $fcv; 

      } 

      preg_match_all('/<div class="contCol '.$divClass.'"><h3>.*?<\/h3>.*?<\/div>/s', $prStr, $matches); 

      $randAlign = array(

       array('topleft'), 
       array('topright'), 
       #array('bottomleft'), 
      # array('bottomright') 

      ); 

      $i=0;     

       $randSelectAlign = $randomizer->fetchEncryptedRandomPhrase($randAlign, 0, $_SERVER['REQUEST_URI']);    
       $randSelectAlign = $randSelectAlign[0]; 



      foreach($matches[0] as $newPar){ 

       $i++; 


       if($randSelectAlign=='topleft'){ 

        echo str_replace('</h3><p>', '</h3><p><span class="imgWrap" style="float:left"><img src="'.$cfg['baseurl'].$randImages[$i].'" width="170" /></span>', $newPar); 

       } 

       elseif($randSelectAlign=='topright'){ 

        echo str_replace('</h3><p>', '</h3><p><span class="imgWrap" style="float:right"><img src="'.$cfg['baseurl'].$randImages[$i].'" width="170" /></span>', $newPar); 

       } 

       elseif($randSelectAlign=='bottomleft'){ 

        echo str_replace('</p></div>', '<span class="imgWrap" style="float:left"><img src="'.$cfg['baseurl'].$randImages[$i].'" width="170" /></span></div>', $newPar); 

       } 

       elseif($randSelectAlign=='bottomright'){ 

        echo str_replace('</p></div>', '<span class="imgWrap" style="float:right"><img src="'.$cfg['baseurl'].$randImages[$i].'" width="170" /></span></div>', $newPar); 

       } 

       else { 

       } 

       //randomly from float array based on server uri! 

       //randomly select a way to display the images here etc  
       # 

      } 

    ?> 

私に次のエラーメッセージが与えている::/ホーム/口座に配列の文字列への変換:

お知らせをここで私は今、以下の提案の後に使用していたコードですライン上/public_html/subdomain/directory/_pages/tier1.php 230

注意:ライン231上の/home/account/public_html/subdomain/directory/_pages/tier1.phpの文字列への変換アレイ

警告:でforeachのために供給される無効な引数():preg_split()は、パラメータ2が文字列、アレイの行に/home/account/public_html/subdomain/directory/_pages/tier1.phpに233

警告を与えることを期待しますコードの行に/home/account/public_html/subdomain/directory/_pages/tier1.php 237

これらの線は、次のとおりです。私は、その配列としてコンテンツを吐き出すためである

230 $fc = preg_replace("/<h3>.*?<\/h3>/", "$0", $content);    
231 $fc = preg_replace("/<h3>.*?<\/h3><p>.*?<\/p>/", "<div class=\"contCol ".$divClass."\">$0$1</div>", $content); 
233 $fca = preg_split("/(\.|\?|\!)/", $fc, -1, PREG_SPLIT_DELIM_CAPTURE); 
235 $prStr = ''; 
237 foreach ($fca as $fck => $fcv) { 

     if ($fck % 3 == 0 && $fck != 0 && !in_array($fcv, array(".", "?", "!"))) 
      $prStr .= "</p>\n<p>"; 

      $prStr .= $fcv; 

    } 

推定しますか?特に正しく出力させるためにデータに行う必要があることは何ですか?

多くのおかげで、

ケビン

答えて

1

コードの上に目をやったが、私はまだランダマイザもの;-)

について困惑しているのに、私は、それを行うことになっているもの、いくつかのアイデアを持っていると思います

JSONデータを文字列として最初のパラメータ($source)としてgenerateContent()メソッドに渡すことができます。

generateContent()は配列を返しますので、formatContent()で実行する必要があります(私はそうだと思います)。

+0

こんにちは@Jack、私はあなたが見て気にしないなら、私が試したことを表示するために上記を編集して、それに間違っていた。私は通常jsonと一緒に仕事をしていないし、蹴ったり叫んだりすると投げ込まれてしまった。 –

+0

私はコード内のどこの行番号が指しているのかわかりません。 –

+0

申し訳ありませんが、私はブロンドの瞬間を持っていた...私は質問を編集し、影響を受けた行を追加しました。何か他のものが必要な場合は、私に戻ってきてください。 –

関連する問題