タグ

ブックマーク / www.php.net (34)

  • PHP: Manual Quick Reference

    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

  • PHP: 文字セット - Manual

    文字セット 適切な文字セットをサーバーレベルで設定しておくのが理想であり、MySQL のマニュアルの » Character Set Configuration にもそうするよう書かれています。 しかしそれ以外にも、各 MySQL API には実行時に文字セットを指定する方法が用意されています。 警告 文字セットと文字のエスケープ 文字セットはきちんと理解して設定しておかないといけません。 すべての操作に影響が及び、セキュリティの問題を引き起こす可能性があるからです。 たとえば、文字列のエスケープ (mysqli なら mysqli_real_escape_string()、 PDO_MySQL なら PDO::quote()) は文字セットの設定に従った動きをします。 これらの関数は、クエリで設定した文字セットは使わないことを知っておくことが大切です。 たとえば次の例のような設定をしても

    PHP: 文字セット - Manual
    masakielastic2
    masakielastic2 2012/07/16
    SQL 文ではエスケープメソッドに使われる文字エンコーディングを指定できないことが明記されるようになった。
  • PHP: どの API を使うか - Manual

    どの API を使うか PHP には、様々な MySQL へ接続する API があります。 以下に、mysqli と PDO が提供する API を示します。 それぞれのコードは、"example.com" 上で稼働する MySQL サーバーに ユーザー名 "user"、パスワード "password" で接続するものです。 そして、クエリを実行してユーザーにあいさつします。 <?php // mysqli $mysqli = new mysqli("example.com", "user", "password", "database"); $result = $mysqli->query("SELECT 'Hello, dear MySQL user!' AS _message FROM DUAL"); $row = $result->fetch_assoc(); echo htmle

    PHP: どの API を使うか - Manual
    masakielastic2
    masakielastic2 2012/07/16
    mysql、mysqli、PDO_MYSQL の比較表が用意された。mysqli は mysqlnd とのノンブロッキングな非同期クエリをサポートする。
  • PHP: 配列演算子 - Manual

    <?php $a = array("a" => "apple", "b" => "banana"); $b = array("a" => "pear", "b" => "strawberry", "c" => "cherry"); $c = $a + $b; // Union of $a and $b echo "Union of \$a and \$b: \n"; var_dump($c); $c = $b + $a; // Union of $b and $a echo "Union of \$b and \$a: \n"; var_dump($c); $a += $b; // Union of $a += $b is $a and $b echo "Union of \$a += \$b: \n"; var_dump($a); ?> Union of $a and $b: array

    PHP: 配列演算子 - Manual
    masakielastic2
    masakielastic2 2011/12/13
    「+ 演算子は、右側の配列を左側の配列に追加したものを返します。 両方の配列に存在するキーについては左側の配列の要素が優先され、 右側の配列にあった同じキーの要素は無視されます。」
  • PHP: 比較演算子 - Manual

    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

    PHP: 比較演算子 - Manual
  • PHP: php:// - Manual

    説明 PHP ではさまざまな入出力ストリームを提供しています。 これらを使うと、PHP 自身の入出力ストリームへのアクセスや 標準入出力と標準エラー出力のファイル記述子へのアクセス、 メモリやディスクを使ったテンポラリファイルストリームへのアクセスができ、 フィルタを使って他のファイルリソースの読み書きに手を加えることもできます。 php://stdin, php://stdout および php://stderr php://stdin、php://stdout および php://stderr は、PHP プロセスの 対応する入出力ストリームへの直接アクセスを許可します。 これらのストリームは複製されたファイル記述子を参照します。そのため、 php://stdin をオープンしたあとでそれを閉じたとしても、 識別子のコピーが閉じられるだけです。STDIN で参照される実際のストリームは

    PHP: php:// - Manual
  • PHP: 外部から来る変数 - Manual

    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

    PHP: 外部から来る変数 - Manual
  • PHP: 文字列 - Manual

    文字列 string は、文字が連結されたものです。PHP では、 文字は 1 バイトと同じです。つまり、256 個の異なる文字を使用可能です。 これは、PHP が Unicode をネイティブにサポートしていないことも意味します。 文字列型の詳細を参照ください。 注意: 32bit ビルドでは、 文字列の最大長は 2GB (2147483647 バイト) です。 引用符 文字列を指定する最も簡単な方法は、引用符 (文字 ') で括ることです。 引用符をリテラルとして指定するには、バックスラッシュ (\) でエスケープする必要があります。 バックスラッシュをリテラルとして指定するには、二重 (\\) にします。 それ以外の場面で登場するバックスラッシュは、すべてバックスラッシュそのものとして扱われます。 つまり、\r や \n といったおなじみのエスケープシーケンスを書いても特別な効果は得

    PHP: 文字列 - Manual
  • PHP: セッションのアップロード状況 - Manual

    セッションのアップロード状況 INI オプション session.upload_progress.enabled を有効にすると、アップロード中の個々のファイルの進捗状況を PHP で追えるようになります。 この情報は、アップロードのリクエスト自体にとっては特に有用ではありませんが、 ファイルのアップロード中にアプリケーションから別のエンドポイントに POST リクエストを (XHR などで) 送って状態をチェックできるようになります。 アップロードの状況は、アップロードの処理中にスーパーグローバル $_SESSION で取得できます。また、 INI オプション session.upload_progress.name で設定した名前でも POST されます。PHP 側では、この POST リクエストを検出すると $_SESSION 内の配列に値を格納します。配列のインデックスは、INI

    PHP: セッションのアップロード状況 - Manual
  • PHP: hex2bin - Manual

    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

    PHP: hex2bin - Manual
    masakielastic2
    masakielastic2 2011/09/27
    php 5.4 で追加
  • PHP: Manual Quick Reference

    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

  • PHP: parse_ini_file - Manual

    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

    PHP: parse_ini_file - Manual
    masakielastic2
    masakielastic2 2011/09/25
    php 5.3 でかなりふるまいが変わっているので注意
  • PHP: 設定ファイル - Manual

    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

    PHP: 設定ファイル - Manual
  • PHP: クラスの基礎 - Manual

    class 各クラスの定義は、classキーワードで始まり、クラス名が続きます。 そしてその後に波括弧のペアが続き、 その中にはクラスのプロパティとメソッドの定義を記述します。 クラス名には、PHP の予約語 以外でラベルとして有効なあらゆる名前を使用することができます。 有効なクラス名は、先頭が文字あるいはアンダースコアで始まり、 その後に任意の数の文字/数字/アンダースコアが続くものです。 正規表現で表すと、 ^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*$ のようになります。 クラスの中には、 定数 や 変数 ("プロパティ" といいます) そして関数 ("メソッド" といいます) を含めることができます。

    masakielastic2
    masakielastic2 2011/09/21
    コンストラクタのシグネチャを変更することができる
  • PHP: アクセス権 - Manual

    アクセス権 プロパティ、メソッドまたは (PHP 7.1.0 以降) 定数のアクセス権 (visibility) は、 キーワード: public, protected または private を指定することにより定義できます。 public 宣言されたクラスのメンバーには、どこからでもアクセス可能です。 protected 宣言されたメンバーには、 そのクラス自身、そのクラスを継承したクラス、および親クラスからのみアクセスできます。 private 宣言されたメンバーには、そのメンバーを定義したクラスからのみアクセスできます。 プロパティのアクセス権 クラスのプロパティは、public, private, または protected として定義することができます。 アクセス権を明示的に指定しない場合、 そのプロパティは public として定義されます。 <?php /** * MyCl

    PHP: アクセス権 - Manual
  • PHP: Lua - Manual

    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

    PHP: Lua - Manual
  • PHP: V8js - Manual

    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

    PHP: V8js - Manual
  • PHP: get_browser - Manual

    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

    PHP: get_browser - Manual
  • PHP: Mysqlnd - Manual

    For those who manually compiled MySQL, the default mysqlnd settings may results in error. Your mysql_error() function may give you this message: --------------------------- No such file or directory (trying to connect via unix:///tmp/mysql.sock) --------------------------- This is because your manually compiled MySQL has its own place for socket. You need to provide PHP a reference for an appropri

    PHP: Mysqlnd - Manual
  • PHP: MySQL (PDO) - Manual

    はじめに PDO_MYSQL は、PHP から MySQL データベースへのアクセスを可能にするための PHP Data Objects (PDO) インターフェイス を実装したドライバです。 PDO_MYSQLは、 デフォルトでエミュレートされたプリペアドステートメントを使います。 MySQL 8 PHP 7.1.16 より前のバージョン、もしくは PHP 7.2.4 より前の 7.2系の PHP では、 MySQL 8 サーバーのデフォルトパスワードプラグインを mysql_native_password に設定するようにしてください。 さもないと、 The server requested authentication method unknown to the client [caching_sha2_password] のようなエラーを見ることになります。たとえあなたが cach

    PHP: MySQL (PDO) - Manual