まず、PHPのオタクではありません。 フロントエンドでAMFPHP2をFlexで使用しています。 型付きが細かいオブジェクトとして私は、バックエンドからデータを取得することができますが、私が保存しようとすると、私は以下のように、この問題が生じています:以下配列としてstdClass型のオブジェクトを使用することはできません
Line86 public function saveCollection($collection) {
Line87 for ($i=0; $i<count($collection); $i++) {
Line88 $this->saveItem($collection[$i]);
Line89 }
Line90 }
:以下
<br /><b>Fatal error</b>: Cannot use object of type stdClass as array in <b>/mnt/array1/share/htdocs/htdocs/admin/application/amf/services/Item.php</b> on line <b>88</b><br />
コードはこのエラーを投げています私のVOクラスは、次のとおりです。 ItemVO.php
class ItemVO {
..
..
var $_explicitType = "ItemVO";
..
..
}
ItemVO.as
ここでが私のフォルダ構造である:ここで
-root/
------*.html
------*.swf
------application/
-----------------amf/
--------------------/index.php
--------------------/models/vo/all vo files
--------------------/services/all services
-----------------libraries/
--------------------------/Amfphp/
は私のindex.phpが
ある<?php
require_once dirname(dirname(__FILE__)) . '/libraries/Amfphp/ClassLoader.php';
$config = new Amfphp_Core_Config();
$config->serviceFolderPaths = array(dirname(__FILE__) . '/services/');
$voFolders = array(dirname(__FILE__) . '/models/vo/');
$customClassConverterConfig = array(‘customClassFolderPaths’ => $voFolders);
$config->pluginsConfig['AmfphpCustomClassConverter'] = $customClassConverterConfig;
$gateway = Amfphp_Core_HttpRequestGatewayFactory::createGateway($config);
$gateway->service();
$gateway->output();
?>
すべてのヘルプは大歓迎されます。おかげさまで
です。var_dump($ collection)を87行目で試してみると、問題が発生する可能性があります。 –
変数全体をダンプするよりも、特に非常に大きい場合は、gettype($ collection)とするより良い解決策です。 – OpenSorceress
PHP側のように見えますが、ArrayCollectionsを処理できません。ArrayCollectionsではなくclientsideからArrayを送信してコードを試しましたが、そのまま動作しました。すべての入力に感謝します。 –