摘要:
Selector.php下载:先把图片文件下载,然后把扩展名改成.zip,最后解压缩 <?php require "selector.php"; function getGasolinePrice() { try { $curl = curl_init(); curl_setopt_array($c 阅读全文
摘要:
\(\'+[\\u4e00-\\u9fa5_a-zA-Z0-9\s]+?\'\) 阅读全文
摘要:
<?php //定义一个数组 $array = array(0 => 'a', 1 => 'b', 2 => 'c', 3 => 'd'); //使用 array_search('要搜索的值',数组); $key = array_search('b', $array); // $key = 1; $ 阅读全文
摘要:
function randString():string { $code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; $rand = $code[rand(0,25)] .strtoupper(dechex(date('m'))) .date('d').substr(time() 阅读全文
摘要:
创建模型: php artisan make:model Models/User 创建控制器: php artisan admin:make UserController --model=App\\Models\\User php artisan cache:clear php artisan co 阅读全文
摘要:
def is_between(start_at, end_at) -> bool: """ 判断当前时间是否在指定时间之间 例如:指定时间段为[09:00:00, 18:00:00]若当前时间是 2021年8月16日17:53:45 ,判断是否在这个时间段,返回 True 另外:若指定时间段为[22 阅读全文
摘要:
Python string强转int def to_int(my_str) -> (int, bool): try: int(my_str) return int(my_str) except ValueError: # 报类型错误,说明不是整型的 try: float(my_str) # 用这个来 阅读全文
摘要:
/^([a-zA-Z0-9]+[_|_|\-|.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|_|.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,6}$/ 支持中间带点的邮箱格式,例如: bill.gates@gmail.com、elon.musk@twitter.c 阅读全文
摘要:
由于公司项目需要获取谷歌搜索结果。可是谷歌搜索出来的结果大多都不足20页。直接上代码 import time from pprint import pprint import requests from bs4 import BeautifulSoup class GoogleSpider: def 阅读全文
摘要:
public static function object_array($array) { if(is_object($array)) { $array = (array)$array; } if(is_array($array)) { foreach($array as $key=>$value) 阅读全文