私はZend Formを使用して、データベースにカレッジクラスを追加することができます。私はデータを収集し、それをDoctrine 2で永続させます。データはすべてテーブルにあります。データを取得すると、すべての準備が整います。Zend_Json ::二重引用符で問題をエンコード
array
0 => &
array
'id' => int 151
'className' => string 'Geocaching (Jee-oh-Cash-ing) is part of a worldwide outdoor game for GPS users. Go on an adventure to find hidden treasure, called “geocaches”. If you own a GPS receiver or a smartphone, bring it (preferred, but not required) along with some fresh batteri' (length=255)
'instructor' => string 'Geocaching (Jee-oh-Cash-ing) is part of a worldwide outdoor game for GPS users. Go on an adventure to find hidden treasure, called “geocaches”. If you own a GPS receiver or a smartphone, bring it (preferred, but not required) along with some fresh batteri' (length=255)
'classDescription' => string 'Geocaching (Jee-oh-Cash-ing) is part of a worldwide outdoor game for GPS users. Go on an adventure to find hidden treasure, called “geocaches”. If you own a GPS receiver or a smartphone, bring it (preferred, but not required) along with some fresh batteri' (length=255)
次に、すべてのテーブルデータを表示するためにJquery DataTablesを使用しています。私はdatatableのjqueryをレンダリングするビューヘルパーを持っています。ビューヘルパー内で使用している
Zend_Json::encode(array_merge($this->_defaultOptions, $options), false, array('enableJsonExprFinder' => true));
二重引用符を持つすべての値は、nullとしてエンコードされます。
"aaData":{"id":151,"className":null,"instructor":null,"classDescription":null,}}'
他の値は、二重引用符を含む値を除いてすべてDataTableに表示されます。
私はZend Formに更新を行うためにデータを再入力しようとすると、この問題が発生するので、何か本当に間違っている必要があります。
また、Doctrineの結果をダンプすると、引用されたすべてのデータがすぐに使用できます。しかし、$ form-> setDefaults($ results [0])の後、フォームのフィールドは空白になります。
本当にありがとうございます。
私はあなたがこれが動作しているように一定JSON_HEX_QUOT
を使用する必要があると思う
の代わりに使用します。私はJSONを見ました。私はテーブルを生成するときに、ビューヘルパーでenableJsonExprFinderを使用しています。enableJsonEを使用しないでxprFinder私は手動で行うことなくjsonに関数を構築する簡単な方法を知らない。 – lumberjacked
ええと、これはまさに私が見つけたものですが、彼の呼び出しコードが正しいことを確認する必要がありました。 Zendのバージョンの代わりにPHPのバージョンを使うべきです。そうした場合、デフォルトで引用符をエスケープする必要があります。 –