私は定数を返すこの関数を持っています..ここに私のクラスと関数があります:
class Backlinks extends GoogleSearch {
const ROBOTS_NOINDEX_NOFOLLOW = 606;
function robotsNoIndexNoFollow(){
$crawler = new Connection();
$curl = $crawler -> setUrl($this->url) ->getDocument();
if ($curl){
$html = new simple_html_dom($curl);
$robots = $html -> find("meta[name=robots]", 0);
$html -> clear();
unset ($crawler);
if ($robots){
$content = $robots -> getAttribute("content");
$content = strtolower($content);
if (substr_count($content, "noindex")){
return ROBOTS_NOINDEX_NOFOLLOW;
}
if (substr_count($content, "nofollow")){
return ROBOTS_NOINDEX_NOFOLLOW;
}
}
else{
return false;
}
}
}
上記の問題は ROBOTS_NOINDEX_NOFOLLOW コンタントにあります。定数は、データベースで更新されるエラー パラメータとして別の関数に入ります。
public function setStatus($error){
$status = $error;
if (!$error){
$status = 200;
}
// only update the pages which weren't already scanned (for historic purposes).
$query = "UPDATE task_pages tp
SET scan_status = $status
WHERE page_id = $this->pageID AND scan_status = 0";
mysql_query($query) or die(mysql_error());
}
2 つのエラーが表示されます。
Notice: 未定義の定数 ROBOTS_NOINDEX_NOFOLLOW の使用 - C:\Program Files (x86)\Zend\Apache2\htdocs\backlinks\cron\Backlinks.php の 78 行目で 'ROBOTS_NOINDEX_NOFOLLOW' を想定 'field list' に不明な列 'ROBOTS_NOINDEX_NOFOLLOW'
1つは、定数が定義されていないという問題です..理由がわかりません。2 番目の問題は、定数を列として解釈する sql.. にあります?!?
それを修正する理由と方法は?