Skip to content

Instantly share code, notes, and snippets.

@wakasann
wakasann / readlogfileeachline.php
Created November 24, 2017 16:59
phpreadonefileeachline
<?php
//read log file each line,i only need get url line,so use strpos method
// my log file text is:
// /test/index.php //url
// 2017-11-19 00:00;:00 // datetime
// <pre>Array // echo "<pre>";print_r(array());echo "</pre>";
// (
// )
// </pre>
create table mainlog(id INTEGER PRIMARY KEY AUTOINCREMENT,user_id INTEGER,logdate DATE,start_time DATETIME,end_time DATETIME,created_at DATETIME,update_at DATETIME)
INSERT INTO mainlog (id, user_id, logdate,start_time, end_time, created_at, update_at) VALUES(1, 64, \'2017-05-20\', \'2017-05-20 22:55:57\', \'2017-05-20 23:05:46\', \'2017-05-20 22:55:57\', \'0000-00-00 00:00:00\')
int potPin = 2; //定义模拟端口2连接LM35温度传感器
void setup()
{
Serial.begin(9600);
}
void loop()
{
int val; //存放读取的电压值
int photocellPin = 2; //定义变量 photocellsh=2,为电压读取端口
int ledPin = 12; //定义变量ledPin=12,为led电平输出端口
int val = 0; //定义val变量的起始值
void setup()
{
pinMode(ledPin,OUTPUT); //使ledPin为输出端口
Serial.begin(9600);
}
//Arduion 基础入门套件教程 第7章 蜂鸣器实验
int buzzer = 7;
void setup()
{
pinMode(buzzer,OUTPUT);
}
void loop()
{
//Arduion 基础入门套件教程 第6章 交通灯设计实验
int ledred = 10; //red led
int ledyellow = 7; //yellow led
int ledgreen = 4; //green led
void setup()
{
pinMode(ledred,OUTPUT);
pinMode(ledyellow,OUTPUT);
pinMode(ledgreen,OUTPUT);
int brightness =0; //defined the int var brightness and set the init value,it is use to show the led light
int fadeAmount = 5; //defined int var fadeAmount,it use to set the light add/mins count
void setup()
{
pinMode(9,OUTPUT); //set the prot 9 is output port
}
void loop()
{
//set controll led number IO foot
int Led1 = 2;
int Led2 = 3;
int Led3 = 4;
int Led4 = 5;
int Led5 = 6;
int Led6 = 7;
//led style 1
//Port 13 +
//resistance(电阻)
//Led(辨别LED灯正负极:1.长脚是正极,短脚是负极;2.发光二极管管体内部金属极较小的是正极,大的片状的是负极)
//Port GND -
int ledPin = 13;
void setup()
{
pinMode(ledPin,OUTPUT);
}
@wakasann
wakasann / yii2andorlike.php
Last active November 18, 2016 04:05
yii2 where or and like
<?php
// where status='Open' and category='1' and subCategory='1' and (category like '%test%' or subCategory like '%test%' or title like '%test%' or introduction like '%test%')
//@link http://stackoverflow.com/a/31558035/5840474 get and or
//@link http://stackoverflow.com/a/28593956/5840474 get like
$where = array(
array(
'and',
"status='Open'"
)
);