Skip to content

Instantly share code, notes, and snippets.

@hashihei
hashihei / myfirstcontroller-routes-web.php
Last active May 26, 2019
[myfirstcontroller]ルーティング
View myfirstcontroller-routes-web.php
Route::get('/', function () {
return view('welcome');
});
Route::get('myfirstpage', 'myfirstController@index');
View myfirstcontroller-Controllers-myfirstController.php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class myfirstController extends Controller
{
public function index()
{
//user php function
$user_agent = $_SERVER['HTTP_USER_AGENT'];
$user_ip = $_SERVER['REMOTE_ADDR'];
View app-models-myfirstModel.php
<?php
namespace App\models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class mysqlModel extends Model
{
//getMariaDBUserlist
public function getUsers()
View resources-views-myfirstpage.blade.php
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>myfirstpage</title>
<!-- <meta name="description" content=""> -->
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- <link rel="manifest" href="site.webmanifest"> -->
<!-- <link rel="apple-touch-icon" href="icon.png"> -->
View gist:f8337a0b6644e0031df5a73e62a84e07
/*記事に紐づけられたタグ配列情報を取得*/
$tags = get_the_tags();
/*タグ情報が空かどうかを確認*/
if ( !empty( $tags ) ) {
/*タグ情報が設定されている場合は、1つ目のタグ情報を読み取り、
fontawsomeのタグを構成し、出力する */
echo '<div><i class="' . $tags[0]->description . '"></i><div>' . $tags[0]->name . '</div></div>';
}else{
View python_main_argv_sample.py
import sys
import numpy as np
def numPrint(num):
print("numprint:" + str(num))
if __name__ == '__main__':
args = sys.argv