全文検索:
- 30 Laravel Mail @11_php:02_framework:01_laravel
- vel/config/mail.phpで行っていますが、実際の記述は.envファイルに記述する <code> MAIL_DRIVER=smtp MAIL_HOST=mail.hogehoge.net MAI... MAIL_PASSWORD=hogepassword MAIL_ENCRYPTION=null </code> ===== 2.mailableクラスを生成 ===== php artisan mak... ll app/Mail/MailSend.php ===== 3.メール本文作成 ===== <code> $ cat resources/views/mail/MailSend.blade.php {{$content->name}} さんはじめまして。 テストメール </code> ===== 4.mailableクラスの変更 ===== <code|app/Mail/Ma
- 47 Laravelコマンドからコマンドヘルプを呼び出す @11_php:02_framework:01_laravel
- $this->call('help',['command_name'=>'コマンド名']) <code> protected $signature = 'command:TestCommand {arg... 'command_name'=>'command:TestCommand']); exit; } } </code> {{tag>Laravel}}
- 03 自動で定義済みの定数
- .predefined.php|自動で定義済みの定数]] ===== 例1. ===== <code> <?php //test_01.php echo "__LINE__ -> ".__LINE_... ON__ -> ".__FUNCTION__."\n"; return $res; } ?> </code> <code console> $ php test_01.php __LINE__ -> 3 __FILE__ -> /home/matsui/test.php __DIR__ -> /home/matsui __FUNCTION__ -> test_function </code> ===== 例2. ===== <code> <?php //test_02.php nam
- 14 Laravel Model @11_php:02_framework:01_laravel
- 1. Model作成 ===== この場合だと、testテーブルを作成するという意味です。 <code> php artisan make:model Test $ ll app/Test.php ... -- 1 matsui users 140 Jan 22 16:49 app/Test.php </code> ==== Modelの中で、テーブル名を指定する場合 ==== <code|app/Test.php > class Test extends Model { protected $table = 'test_tables'; } </code> ===== 2. Modelを使う ===== ==== Migrateを用意(テーブル作成
- 03 strlen() @11_php:03_function
- == 書式 ===== strlen("文字列、変数"); ===== 例1 ===== <code> <?PHP $str=strlen("asdqwe"); print($str); ?> </code> ===== 例2 ===== 日本語は2バイト文字なので、この場合12となる。 <code> <?PHP $str="こんにちは。"; print(strlen($str)); ?> </code> {{tag>php}}
- 05 substr() @11_php:03_function
- 05 substr() ====== 文字列の一部を取り出す ===== 書式 ===== <code> string substr(string s, int si) string substr(string s, int si, int sz) </code> 文字列 s のインデックス si から sz バイト分の文字列を取り出します。 途中から最後ま... を取り出す場合は、sz を省略できます。 ==== 例1 ==== 結果はABCとなります。 <code> <?PHP $str="ABCDEFG"; print substr($str,0,3); ?> </code> ==== 例2 ==== siにマイナスをの値を指定すると、後ろから指定した数までを求めます
- 35 Laravel Curlの代わりにGuzzleを使う @11_php:02_framework:01_laravel
- er require guzzlehttp/guzzle ==== 1.シンプル利用 ==== <code> use GuzzleHttp\Client; $url = 'https://hoge.hog... onseBody = $response->getBody()->getContents(); </code> ==== 2.JSON-RPC 2.0 ==== 下記はZabbix apiでアラートを取得する例 <code> use GuzzleHttp\Client; $url = "http://hogeho... ody()->getContents(); return $responseBody; </code> ==== 3.XML_RPC ==== === Controller === <code
- 28 Laravel Voyager フロントページ用意 @11_php:02_framework:01_laravel
- コントローラ作成 ※コントローラ内でテーブルを指定しない場合、同じ名前のテーブルを参照する。 <code> php artisan make:model Post </code> 下記ができる <code|app/Post.php> <?php namespace App; use Illuminate\Database\Eloquent\Model; class Post extends Model { // } </code> === 2.ルーティング === <code|routes/web.php> Route::
- 46 Laravel log @11_php:02_framework:01_laravel
- constructにLogを利用すると、他のコマンドでもログが出力されてしまう。。。(^^; <code> public function __construct() { ... his->mess_head." END send:$this->count"); } </code> app/Http/Kernel.phpとapp/Console/Kernel.php のbo
- 09 curl @11_php:03_function
- ====== 09 curl ====== <code php> $conn = curl_init(); curl_setopt($conn, CURLOPT_URL, $url); curl_setop... sult = json_decode($ret, true); return $result; </code> === Basic認証の場合 === <code php> curl_setopt($conn, CURLOPT_USERPWD, "User:Password"); </code> === cookieを利用する場合 === <code> $cookie=tempnam(s
- 45 Laravel APIトークンが変わってしまう @11_php:02_framework:01_laravel
- 、なぞに思ってたけど ログアウトすると、tokenを変更する事が判明 この部分で、変更している <code|vendor/laravel/framework/src/Illuminate/Auth/Sess... Token())) { 491 $this->cycleRememberToken($user); 492 } </code> {{tag>php Laravel}}
- 40 Laravel SSH/SCP @11_php:02_framework:01_laravel
- = 40 Laravel SSH/SCP ====== ===== 設定ファイル ===== <code|config/remote.php> 'connections' => [ ... 'timeout' => 10, ], ], </code> ==== 直前に指定する方法 ==== <code> Config::set('remote.connections.production.host', 'XXX.XXX.XXX.XXX'); Con... un(array( 'cd /home/taro', 'touch aloha', )); </code> ===== 標準出力を変数に入れる方法 ===== [[https://qiita.com/
- 15 file_get_contents SSL エラー
- g: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL r... failed in xxxxx というエラーが表示されます。 ===== 対策 ===== <code> $url = "https://xxxxxx"; $options['ssl']['verify... false; $response = file_get_contents($url, false, stream_context_create($options)); </code> {{tag>php}}
- 14 file_get_contentsのタイムアウト
- ===== php.iniを使わない場合 ===== ストリームコンテキストで書いてあげる <code> $ctx = stream_context_create(array( 'http' =... imeout' => 120 ) ) ); file_get_contents("http://example.com/", 0, $ctx); </code> {{tag>php}}
- 43 Laravel APIトークン名(api_token)を変更 @11_php:02_framework:01_laravel
- = デフォルトのトークン名 ===== デフォルトのトークン名が記述されている場所は下記です。 <code> vendor/laravel/framework/src/Illuminate/Auth/Aut... kenGuard.php: $storageKey = 'api_token', </code> ===== カスタムガード作成 ===== <code|app/Services/Auth/MyTokenGuard.php> <?php namespace App\Services\Auth; u... t, 'remember_token', 'remember_token'); } } </code> ===== カスタムガードをアプリに登録 ===== <code|app/Provider