[PHP]Cannot use object of type stdClass as array
根本的な解決ではないかもしれませんが、「Cannot use object of type stdClass as array」エラーが出る場合は、配列の扱い方を以下のように変更する事で解決しました。
$row["catID"]
↓
$row->catID
根本的な解決ではないかもしれませんが、「Cannot use object of type stdClass as array」エラーが出る場合は、配列の扱い方を以下のように変更する事で解決しました。
$row["catID"]
↓
$row->catID
私の環境では、デスクトップにあるファイル(デスクトップに限らずPC上のすべてのファイル?)の拡張子が表示されない設定になっており、時々、不便に感じることもあったので、それを変更しました。
拡張子を表示させるには、以下のように設定を変更します。
XPの場合
「コントロールパネル」→「フォルダオプション」→「表示」タブをクリックし、下の詳細設定の項目から「登録されている拡張子は表示しない」のチェックを外します。
vistaの場合
「コントロールパネル」→「デスクトップのカスタマイズ」→「フォルダオプション」→「表示」タブをクリックし、詳細設定の欄から「登録されている拡張子は表示しない」のチェックを外します。
Parse error: syntax error, unexpected T_ECHO in /home/yamazon/public_html/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()’d code on line 6
以下のようにSQLを実行することで該当箇所が置き換えされます。
phpのstr_replaceのような感じ。
UPDATE `テーブル名` SET フィールド名 =REPLACE (フィールド名,”置き換え前文字列”,”置き換え後文字列”);
<script type=”text/javascript”>
<!–
if(navigator.userAgent.indexOf(“MSIE”) > -1){ //Internet Explorer
document.write(‘<!-’+'-[if IE]>’);
document.write(‘<input type=”button” value=”お気に入りに追加“‘);
document.write(‘ onclick=”window.external.AddFavorite(\’サイトURL\’,\’サイト名\’)”>’);
document.write(‘<![endif]-’+'->’);
}
else if(navigator.userAgent.indexOf(“Firefox”) > -1){ //Firefox
document.write(‘<input type=”button” value=”ブックマークに追加“‘);
document.write(‘ onclick=”window.sidebar.addPanel(\’サイト名\’,\’サイトURL\’,\’\');”>’);
}
else if(navigator.userAgent.indexOf(“Opera”) > -1){ //Opera
document.write(‘<a href=”サイトURL” rel=”sidebar” title=”サイト名“>ブックマークに追加</a>’);
}
else { //該当なし
void(0); //何もしない
}
//–>
</script>
今回RSSを取り出すのに使っていた「MagpieRSS」を以下のように使っていたのですが、
include (‘rss_fetch.inc’);
require_once ‘code_table.ucs2jis’;
require_once ‘jcode.php’;
繰り返し処理を行おうとしたところ、Fatal error: Cannot redeclare phpでのエラーとういうエラーが出現するので、以下のように修正したら、とりあえず動くようになりました。
ちゃんとした解決策なのかどうかは不明ですが・・・( ; ゚Д゚)
require_once (‘rss_fetch.inc’);
require_once ‘code_table.ucs2jis’;
require_once ‘jcode.php’;
$example_array= array( "green", "red", "green", "blue", "red");
phpで上記のような配列から、重複要素を削除するには
$example_array = array_unique($example_array);
とすることで重複要素は削除されます。
$img_path // 取得する画像のパス(URL)
$path = “ここは保存先のパス”; // /home/ドメイン/public_html/imagesなど
$img = file_get_contents($img_path) ;//画像を取得
$fullpath = $path.basename($img_path);//画像の保存フルパス
file_put_contents($fullpath, $img);//保存。
*basename >> パス中のファイル名の部分を返す
最近のコメント