簡體   English   中英

注意:未定義的索引:類別

[英]Notice: Undefined index: category

注意:未定義的索引:第18行的/opt/lampp/htdocs/content/cron/check_deposits.php中的類別

$deposits=mysql_query("SELECT * FROM `deposits`");
while ($dp=mysql_fetch_array($deposits)) {
  $received=0;
  $txid='';
  $txs=$wallet->listtransactions('',2000);
  $txs=array_reverse($txs);
  foreach ($txs as $tx) {
  if($tx['category']!='receive') continue;
  if ($tx['confirmations']<1) continue;
    if ($tx['address']!=$dp['address']) continue;
    $received=$tx['amount'];
    $txid=$tx['txid'];
    break;

這就是開箱即用的方式。 我聯系了有關此問題的支持,他們告訴我確保我使用的是PHP 5.3.1。 這有什么問題?

這是完整代碼的鏈接: http : //diceking.tk/deposit.txt

您需要從

if($tx['category']!='receive') continue;  

if(isset($tx['category']) && $tx['category']!='receive') continue;

檢查是否設置了變量。 因此,對於有關確認的錯誤,可以使用以下命令:

if(isset($tx['confirmations']) && $tx['confirmations'] < 1) continue;

對於有關未定義索引:類別的錯誤,可以使用以下命令:

if(isset($tx['category']) && $tx['category']!='receive') continue;

希望能對您有所幫助。 如果這有幫助,請投票給我答案。

注意:未定義的索引:在第21行的/opt/lampp/htdocs/content/cron/check_deposits.php中的數量注意:未定義的索引:在第22行的/opt/lampp/htdocs/content/cron/check_deposits.php中的txid未定義的索引:第21行上的/opt/lampp/htdocs/content/cron/check_deposits.php中的數量注意:未定義的索引:第22行的/opt/lampp/htdocs/content/cron/check_deposits.php中的txid

嗯,所以到目前為止,我們已經做到了。.我嘗試了這個技巧,但為此我非常討厭:

if(isset($received=$tx['amount']) && $received=$tx['amount']) continue;

暫無
暫無

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

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