In the first two parts of this series I wrote about namespaces and late static binding. In this part I will cover mysqlnd (MySQL native driver for PHP), which is also a really cool feature of PHP 5.3. This a replacement library (not an extension) for libmysql (MySQL Client Library) offering a lot of advantage over it. While libmysql was developed primarily for C and C++, mysqlnd was designed and o
PHP is a good language, but there are always surprises. And today I've seen an interesting approach in Arnold Daniels's blog. He talks about temporary variables in PHP. This tip is useful to "lazy" developers who do not even think about variable names. They may prefer magic names like ${0} and 0 is good enough variable name, why not... But I'm even more lazy then Arnold and sure that when there is
Recently, I learned something new about one of the oldest technologies I regularly use – email. Once you get beyond putting a simple plain text email together for sending from a web app, email can get pretty complicated. Sending things in multiple formats (such as HTML with a plain text fall-back), sending attachments, using different encodings and so on, generally there’s quite a lot to know abou
メモ, PHP【PHP TIPS】 58. すごいリロード対策紹介されているのはシンプルなワンタイムトークン.単純なリロード対策であれば ticket の値は乱数でなくても良い.ここを乱数にすることで CSRF 対策も兼ねている.ただこの方法は,場合によってはフォームを正常に送信できなくなってしまう問題がある. 例えば,入力画面→入力確認画面と遷移してから別のウィンドウで入力画面→入力確認画面と遷移すると,前の入力確認画面のフォームは ticket が無効になり,フォームを送信できなくなる(複数画面同時編集ができない). 解決策としては,発行したトークンを全て記憶しておき,POST されたトークンと照合する方法がある. confirm.php session_start(); $token = sha1(uniqid(mt_rand(), true)); // トークンをセッションに追加す
Webアプリケーション開発の定番言語であるPHP言語を、言語仕様から実用的なプログラミングテクニックまで詳細に解説―「本書を読み終えることで、PHP言語の動作原理を知ることができます。また、PHPに付属する多くの拡張モジュールの使用方法を身に付け、自分でPHPのウェブアプリケーションを設計して作成できるようになるでしょう。」(本書「はじめに」より) PHP言語を扱うすべてのユーザのための本格的解説書。 訳者まえがき 序文 はじめに 1章 PHPについて 1.1 PHPとは 1.2 PHPの歴史 1.2.1 PHPの誕生 1.2.2 PHPの発展 1.3 PHPのインストール 1.4 PHPの例 1.4.1 設定情報のページ 1.4.2 フォーム 1.4.3 データベース 1.4.4 グラフィックス 1.4.5 シェルからの使用 2章 PHP言語の基本 2.1 字句構造 2.1.1 大文字/
Getting Started Introduction A simple tutorial Language Reference Basic syntax Types Variables Constants Expressions Operators Control Structures Functions Classes and Objects Namespaces Enumerations Errors Exceptions Fibers Generators Attributes References Explained Predefined Variables Predefined Exceptions Predefined Interfaces and Classes Predefined Attributes Context options and parameters Su
By: Roy Ganor Introduction Martin Fowler is my mentor! It is not only due to his paper on the emerging usage of Domain Specific Languages, nor solely because of his useful advice on continuous integration techniques, but because of the way he describes the refactoring process for computer languages. At first, refactoring seemed to me to be magic, over the years I have come to view it as mor
PHPからDBを使うときにはPEAR::DBをお使いの方もまだたくさんいらっしゃると思います。しかし、PEAR::DBのマニュアルにも「This package been superseded by MDB2 but is still maintained for bugs and security fixes」(このパッケージの代わりにMDB2の使用が推奨されますが、バグの修正、セキュリティフィックスは引き続き行われます。)と書かれているとおり、今後はPEAR::MDB2をお使いになることをお奨めいたします。 ということで、今回はPEAR::MDB2についてご紹介したいと思います。 PEAR::MDB2 マニュアル http://www.go-pear.org/manual/ja/package.database.mdb2.php MDB2についてはこちらをご覧下さい http://ww
Kore Nordmann’s post “Why Active Record sucks” explains some of the issues you get by using the popular Active Record pattern for ORM purpose in more complex situations. “AR is just a wrapper for database access and not appropriate as an ORM. Used carefully, or with very simple applications it really may proof useful.” I often find myself considering an ORM tool when I start working on a new datab
Ajaxを使ってフォームのフィールドの変化に応じてdivの中身を入れ替えるような処理の場合、ブラウザの「戻る」機能を正常に使うことができなくなります。 フォントサイズの変更や「戻る」「進む」などのブラウザが標準で搭載している機能が使えなくなることはユーザの自由を奪ってしまうことになり、ユーザビリティがよくありません。 いろいろ調べてみたところ、「みかログ: Ajaxと戻るボタン・ブックマーク」というサイトにて対処法を発見しました。 ポイントとしては、 IE以外ではlocation.hashで各オペレーションに対して異なるhashを生成 IEでは隠しIFRAMEにlocation.hash生成 というあたりらしいです。 Javascriptを直接記述する場合は上記サイトのjQueryプラグインで事足りると思いますが、私の場合Symfonyを使用していたため、その中のヘルパ関数であるobser
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く