Skip to content

Instantly share code, notes, and snippets.

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
<?php
$posts = array();
array_push($posts,(object) [
'title' => $entry->title
,'author' => $entry->author
,'permalink' => $entry->url
,'created' => new Carbon('2019-07-29 12:24:51')
,'description' => $entry->description
,'content' => $entry->content
]);
<?php
$posts = array();
array_push($posts,(object) [
'title' => $entry->title
,'author' => $entry->author
,'permalink' => $entry->url
,'created' => new Carbon('2019-07-29 12:24:51')
,'description' => $entry->description
,'content' => $entry->content
]);
<?php
//APP_ENVで分岐
Route::group([
'domain' => 'fuga.hoge.'.((env('APP_ENV') == 'production') ? 'com' : 'app')
], function() {
Route::get('/', function () { return view('hoge/index'); });
Route::resource('/app', 'AppController')->except([
'index', 'create', 'edit'
]);
Route::get('/data/{any}', function ($any=null) { //vue-routerでルーティングする
<?php
//ローカル設定
Route::domain('fuga.hoge.app')->group(function(){
Route::get('/', function () { return view('hoge/index'); });
Route::resource('/app', 'AppController')->except([
'index', 'create', 'edit'
]);
Route::get('/data/{any}', function ($any=null) { //vue-routerでルーティングする
return view('hoge/data');
})->where('any', '.*');
<?php
$client = new \GuzzleHttp\Client([
'cookies' => true
,'http_errors' => false
]);
$client->post('https://secure.nicovideo.jp/secure/login',[
'form_params' => [
'mail' => $mail,
'password' => $password
]
<?php
foreach ($result->get_items() as $item) {
echo $item->get_title();
}
<?php
$feed = App::make('feed');
$feed->title = 'Title';
$feed->description = 'Description;
$feed->logo = 'Logo';
$feed->link = url('tag');
$feed->setDateFormat('carbon');
$feed->pubdate = $posts[0]->created;
$feed->lang = 'ja';
<?php
$feed = FeedReader::read(
'https://www.nicovideo.jp/tag/MikuMikuDance?sort=f&rss=2.0'
);
<?php
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://example.com/wp-json/wp/v2/'
]);
$response = $client->get('media',[
'query' => ['slug' => 'sample']
]);
$result = json_decode($response->getBody()->getContents());
return (count($result)) ? $result[0]->id : null;