S2Dao.PHP5+MySQL5で文字化けした場合


メモです。


/**
 * @Dao(bean = ItemsEntity)
 */
interface ItemsDao
{

    /**
     * @Sql("SET NAMES utf8")
     */
    public function init();

    /**
     * @Query("delflg = 0 ORDER BY items.insdate")
     * @return array
     */
    public function getAll();

    /**
     * @Query("id = ? AND delflg = 0 ORDER BY upddate DESC")
     */
    public function getItem($id);

    public function insert(ItemsEntity $department);
    public function update(ItemsEntity $department);

}

Dao#initメソッドを作ってSET NAMES 文字コードを定義。それをDaoを使う時に呼び出す。

関連記事:

  1. gitにpushしたwebサイトを自動的に同期させる
  2. Services_Twitter
  3. メモ:safemodeでWPとNextGen Galleryを動かすための設定

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

*

次のHTML タグと属性が使えます: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>