LoginSignup
7
7

More than 5 years have passed since last update.

PHPでシリアライズされたファイルをダンプするワンライナー

Posted at

DBよりも手軽に情報を保存するのにシリアライズは手軽ですが、内容の確認がちょっと面倒です。

そこで、シリアライズデータが保存されたファイルを指定すると内容をダンプするワンライナースクリプトです。

dump.php
<?php ! empty( $argv[1] ) ? file_exists( $argv[1] ) ? var_dump( unserialize( file_get_contents( $argv[1] ) ) ) : "" : "";

実行するにはコマンドラインから

$ php -f dump.php serialized.txt

です。

7
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
7