0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

phpLiteAdminのCSV出力時にカンマ区切りをデフォルトに修正する (phpで1ファイルのsqliteブラウザ)

Last updated at Posted at 2025-07-13

公式ページ

設定ファイル

cp -a phpliteadmin.config.sample.php  phpliteadmin.config.php 
- $language = 'en'
+ $language = 'ja'

修正箇所

2396行目あたり

  • カンマ区切りを初期値とする
- echo "<input type='text' value=';' name='export_csv_fieldsterminated' style='float:right;'/>";
+ echo "<input type='text' value=',' name='export_csv_fieldsterminated' style='float:right;'/>";
  • NULLの箇所はNULLという文字を入れない
- echo "<input type='text' value='NULL' name='export_csv_replacenull' style='float:right;'/>";
+ echo "<input type='text' value='' name='export_csv_replacenull' style='float:right;'/>";

image.png

  • 5788行あたり。CSV出力時に改行コードが消えるのを阻止
                                        for($y=0; $y<sizeof($cols); $y++)
                                        {
                                                $cell = $row[$cols[$y]];
                                                if($crlf)
                                                {
-                                                        $cell = str_replace("\n","", $cell);
+                                                        // $cell = str_replace("\n","", $cell);
-                                                        $cell = str_replace("\r","", $cell);
+                                                        // $cell = str_replace("\r","", $cell);
                                                }
                                                $cell = str_replace($field_terminate,$field_escaped.$field_terminate,$cell);
                                                $cell = str_replace($field_enclosed,$field_escaped.$field_enclosed,$cell);
                                                // do not enclose NULLs
                                                if($cell == NULL)
                                                        echo $null;
                                                else
                                                        echo $field_enclosed.$cell.$field_enclosed;
                                                // do not terminate the last column!
                                                if($y < sizeof($cols)-1)
                                                        echo $field_terminate;
                                        }
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?