年紀大了有些事容易忘記... 所以.....

顯示具有 PHP 標籤的文章。 顯示所有文章
顯示具有 PHP 標籤的文章。 顯示所有文章

星期六, 6月 29, 2019

[VSCode] PHP、Laravel 好用外掛套件

VSCode PHP、Laravel 好用外掛套件
PHP function 加上註解
phpdoc-comment-vscode-plugin
https://marketplace.visualstudio.com/items?itemName=rexshi.phpdoc-comment-vscode-plugin
VS Code 的中文(繁體)語言套件
Chinese (Traditional) Language Pack for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=MS-CEINTL.vscode-language-pack-zh-hant

Laravel Extension Pack
https://marketplace.visualstudio.com/items?itemName=onecentlin.laravel-extension-pack

星期六, 10月 20, 2018

[PHP] 在PHP實現MQTT的 Publish (發佈) 及 Subscribe (訂閱)

[PHP] 在PHP實現MQTT的 Publish (發佈) 及 Subscribe (訂閱)

Mosquitto-PHP Documentation
https://media.readthedocs.org/pdf/mosquitto-php/latest/mosquitto-php.pdf

由於網路上的資訊有點亂,所以整理一下自己有在用的並分享出來。

星期三, 11月 09, 2016

[LINE] LINE Messaging API for PHP (LINE BOT)

一直都在等LINE出強大的bot要強化我一些工作上鎖碎的事
不過這次發佈之後,唉唉唉要用Push主動發送還是要錢啊!!!! (好貴....)
嘛啊算了....... 加減用了XD


LINE Messaging 申請網址
https://business.line.me/zh-hant/services/bot
API reference
https://developers.line.me/businessconnect/api-reference

星期二, 5月 06, 2014

Instagram API 教學 (取得 User ID 及照片資訊)

這邊僅用來搜尋帳號資料及取得相片資訊

請先以 Instagram 帳號登入 http://instagram.com/developer/
點擊右上角「管理客戶」填一些基本資料後點選「註冊新客戶」
Website 及 OAuth redirect_url 都填 http://localhost 就可以(除非你有要取得token或上傳等功能才要另外填)

星期四, 4月 17, 2014

PHP 自動等比縮放圖片函式

//取圖片寬高並回傳適合寬高
 /*
  $org_height 原圖高
  $org_width 原圖寬
  $height 限制的高
  $width 限制的寬
  $autoResize 是否強制縮到寬高都在範圍內
  2014/4/17 @C Fixed
 */
 function getImageSize_resize($org_height='',$org_width='',$height='',$width='',$autoResize='N'){
  if(!$org_height || !$org_width){
   return FALSE;
  }
  
  $new_height = '';
  $new_width = '';

  $tmp_width = $org_width;//圖片寬度
  $tmp_height = $org_height;//圖片高度
  
  $ratio = 1;
  
  if(($width && $tmp_width > $width) || ($height && $tmp_height > $height))
  {
   if($width && $tmp_width > $width)
   {
    $width_ratio = $width/$tmp_width;
    $resize_width_tag = true;
   }
   
   if($height && $tmp_height > $height)
   {
    $height_ratio = $height/$tmp_height;
    $resize_height_tag = true;
   }
      
   if($resize_width_tag || $resize_height_tag)
   {
    if($width_ratio > $height_ratio)
    {
     $ratio = $width_ratio;
    }
    else
    {
     $ratio = $height_ratio;
    }
    
    if($resize_width_tag && !$resize_height_tag)
    {
     $ratio = $width_ratio;
    }
    
    if($resize_height_tag && !$resize_width_tag)
    {
     $ratio = $height_ratio;
    }

    $new_width = round($tmp_width*$ratio);
    $new_height = round($tmp_height*$ratio);

    if($autoResize=="Y")
    {
     if(($width && $new_width > $width) || ($height && $new_height > $height))
     {
      return $this->getImageSize_resize($new_height,$new_width,$height,$width,"Y");
     }
    }
    
    return array($tmp_width,$tmp_height,$new_width,$new_height);
   }
  }
  return array($tmp_width,$tmp_height,$new_width,$new_height);
 }

PHP 變更 Session 存放路徑

<?php
session_save_path('tmp');
?>

上述是將 session 存放於 tmp 資料夾的意思