• wsl2 Apache バーチャルホスト設定

    Windowsのhosts ファイルに追加 172 […]

    Windowsのhosts ファイルに追加

     
      172.25.29.190       sample.org
    
    

    ※↑ipアドレスはUbuntu起動時のもの、127。0。0.1 ではないことに注意

    
    
    <VirtualHost *:80>
        ServerAdmin webmaster@sample.org
        ServerName sample.org
        ServerAlias sample.org
        DocumentRoot /var/www/web/public
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
       <Directory /var/www/web/public>
            AllowOverride All
            Options All
            Require all granted
        </Directory>
    </VirtualHost>
    
    
    
  • ページを遷移する前に unloadイベント

    window.addEventListener(‘ […]

    
       window.addEventListener('beforeunload', (event) => {
            event.preventDefault();
            // このページを去る前にローカルストレージを削除;
            localStorage.removeItem('interValId');
        });
    
    
  • lalavel8 サブクエリー (クエリビルダー)

    $sql = “SELECT ←普通のSQL文 F […]

    
     $sql = "SELECT ←普通のSQL文
     FROM
     WHERE " ; 
     
    
     DB::table('app_user_user AS uu')
            ->select( ~ ~ 
    
        ) ->leftJoin( DB::raw("( $sql  ) AS sc ") , 'uu.id', '=', 'sc.user_id')
    
    
    
    	$juhuku = DB::table('issuers')
    		->orWhere(function($query) {
    			$query->where('tel', $this->tel[$this->j])
    			->where('user_id', '!=', $this->user_id);
    		})
    		->orWhere(function($query) {
    		$query->where('email', $this->email[$this->j])
    		->where('user_id', '!=', $this->user_id);
    	})->exists() ;
    
    



    select exists( select * from `issuers` where ( `tel` = '230-0234-5432' and `user_id` != 4604 ) or ( `email` = 'izumo@reqw.wer' and `user_id` != 4604) ) as `exists`

  • localStorage 配列の保存方法

    そのまま保存するとデータ構造が書き換えられて配列が […]

    そのまま保存するとデータ構造が書き換えられて配列がcsv形式になってしまう。

    
    localStorage.setItem('stockoutData', JSON.stringify(stockoutData)); //保存
    
    let stockoutData = localStorage.getItem('stockoutData'); //取得
         let stockouts = JSON.parse(stockoutData);  //変換
    
    
  • wordpress マルチサイト サブディレクトリ 表示されない

    投稿記事に過去1ヶ月よりも前の日付があると出てこな […]

    投稿記事に過去1ヶ月よりも前の日付があると出てこないので、SQL文で一括で昨日とかにする

    
    update `wp_posts` set post_date='2022-01-01 12:12:12'
    ,post_date_gmt = '2022-01-01 03:12:12'
    
    
  • Notice: ob_end_flush(): failed to send buffer of zlib output compression

    対処方法 # vi /etc/php.ini __ […]

    対処方法

    
     # vi /etc/php.ini
    _________________________
    
     zlib.output_compression = Off ← こうする
    _________________________
     # systemctl restart httpd
    
    

    透過的なページ圧縮を行うかどうかを指定します。

    Onを指定した場合、ブラウザが”Accept-Encoding: gzip”または”deflate”ヘッダを送信する際に、ページが圧縮されます。

  • WSL2でUbuntuの初回起動時に0x800701bcが出る

    Linux カーネル更新パッケージのダウンロード […]


    Linux カーネル更新パッケージのダウンロード

    手順 4 – Linux カーネル更新プログラム パッケージをダウンロードする

    最新のパッケージをダウンロードします。

    x64 マシン用 WSL2 Linux カーネル更新プログラム パッケージ
    をいれてたぶん解決。

  • has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

    「CORSポリシーによってブロックされています:要 […]

    「CORSポリシーによってブロックされています:要求されたリソースに「Access-Control-Allow-Origin」ヘッダーがありません。」
    ヘッダーがないのはフロント側ではなく、サーバー側のこと

    サーバー側のファイルの先頭にこれを書くだけでいい

    
    
    <php
      header('Access-Control-Allow-Origin: *');