<?php
function foo() {
echo "In foo()<br />\n";
}
function bar($arg = '') {
echo "In bar(); argument was '$arg'.<br />\n";
}
// 使用 echo 的包装函数
function echoit($string)
{
echo $string;
}
$func = 'foo';
$func(); // This calls foo()
$func = 'bar';
$func('test'); // This calls bar()
$func = 'echoit';
$func('test'); // This calls echoit()
Run code
Cut to clipboard
<?php
class Foo
{
function Variable()
{
$name = 'Bar';
$this->$name(); // This calls the Bar() method
}
function Bar()
{
echo "This is Bar";
}
}
$foo = new Foo();
$funcname = "Variable";
$foo->$funcname(); // This calls $foo->Variable()
Run code
Cut to clipboard
当调用静态方法时,函数调用要比静态属性优先:
Example #3 Variable 方法和静态属性示例
<?php
class Foo
{
static $variable = 'static property';
static function Variable()
{
echo 'Method Variable called';
}
}
echo Foo::$variable; // This prints 'static property'. It does need a $variable in this scope.
$variable = "Variable";
Foo::$variable(); // This calls $foo->Variable() reading $variable in this scope.
#343
#344
code
#345
<button open-type="contact" bindcontact="handleContact"></button> Page({ handleContact (e) { console.log(e.path) console.log(e.query) } })
在页面使用客服消息
需要将 button 组件 open-type 的值设置为 contact,当用户点击后就会进入客服会话,如果用户在会话中点击了小程序消息,则会返回到小程序,开发者可以通过 bindcontact 事件回调获取到用户所点消息的页面路径 path 和对应的参数 query。
path 小程序消息指定的路径
query 小程序消息指定的查询参数
修改 return $_GET["echostr"]
return回来的echostr是带双引号,而echo回来的echostr是不带双引号的。
#346
Remove the data-ride="carousel" attribute to fix JS error
Bootstrap Carousel: Uncaught TypeError: Cannot read property 'offsetWidth' of undefined
改动一下 // ListTouch计算方向 ListTouchMove(e) { this.setData({ ListTouchDirection: e.touches[0].pageX - this.data.ListTouchStart > 0 ? 'right' : 'left' }) }, 这段,改成例如 // ListTouch计算方向 ListTouchMove(e) { var offset = e.touches[0].pageX - this.data.ListTouchStart if (offset > 50) { this.setData({ ListTouchDirection: 'right' }) } else if (offset < -50) { this.setData({ ListTouchDirection: 'left' }) } } 提高触发的偏移值就可以了。
DB::connection()->enableQueryLog(); // 开启查询日志 DB::table('my_table')->insert($data); // 要查看的sql语句执行 $logs = DB::getQueryLog(); // 获取查询日志 dd($logs); // 即可查看执行的sql,传入的参数等等
Laravel 系列:orWhere 条件式
->where(function ($query) use ($keyword) { $query->where('name', 'like', "%{$keyword}%")->orWhere('barcode', 'like', "%{$keyword}%"); })
foreach()循环
要跳出本次循环继续执行下次循环 continue
终止循环
break。
#347
$roomUuid = 1; $chatInfo = DB::table('chat_info') ->where('chat_info.room_uuid', $roomUuid) ->leftJoin('user_rooms', function ($join) { $join->on('user_rooms.user_uuid', '=', 'chat_info.user_uuid') ->on('user_rooms.room_uuid', '=', 'chat_info.room_uuid'); })
#348
function getClientIP() { global $ip; if (getenv("HTTP_CLIENT_IP")) $ip = getenv("HTTP_CLIENT_IP"); else if(getenv("HTTP_X_FORWARDED_FOR")) $ip = getenv("HTTP_X_FORWARDED_FOR"); else if(getenv("REMOTE_ADDR")) $ip = getenv("REMOTE_ADDR"); else $ip = "Unknow"; return $ip; }
#349
#350
给<router-view :key="key"></router-view>增加一个不同:key值,这样vue就会识别这是不同的<router-view>了。
在访问php时生成txt文件
$filename = 'file.text'; //也可以是其他后缀格式的 $ua = $_SERVER["HTTP_USER_AGENT"]; foreach ($fedexinfo as $key => $value) { echo $key.",\"".$value."\"\r\n"; } header("Content-Type: application/octet-stream"); header('Content-Disposition: attachment; filename="' . $filename . '"');
#351
JavaScript API 极速版 V1.0百度地图生成器
<script type="text/javascript" src="http://api.map.baidu.com/api?type=quick&ak=X8u8xx9GzO88EIydfLbTsvbK&v=1.0"></script> <div id="map" style="border:1px solid #ccc; height:180px;"></div> <script type="text/javascript"> // 百度地图API功能 var map = new BMap.Map("map"); map.centerAndZoom(new BMap.Point(<?php echo $longitude;?>,<?php echo $latitude;?>), 19); map.addControl(new BMap.ZoomControl()); //添加地图缩放控件 var marker1 = new BMap.Marker(new BMap.Point(<?php echo $longitude;?>,<?php echo $latitude;?>)); //创建标注 map.addOverlay(marker1); // 将标注添加到地图中 //创建信息窗口 var infoWindow1 = new BMap.InfoWindow("<?php echo $company;?><br><?php echo $address;?>"); marker1.addEventListener("click", function(){this.openInfoWindow(infoWindow1);}); </script>
https://out.img.pan.lizhenqiu.com/0233966207cdd97f0e84d57a4a2534e6
https://out.img.pan.lizhenqiu.com/58eb5506ad9f3e7ec53197f94f513dba
郁欢+-+烟火里的尘埃
霉霉 welcome to newyork 百度云
不爱我拉到 周杰伦 下载
1989 首唱会 iHeartRadio 现场版 泰勒·斯威夫特(Taylor Swift),1989年12月13日出生于美国宾夕法尼亚州
http://famicn.com/
#352
<?php function foo() { echo "In foo()<br />\n"; } function bar($arg = '') { echo "In bar(); argument was '$arg'.<br />\n"; } // 使用 echo 的包装函数 function echoit($string) { echo $string; } $func = 'foo'; $func(); // This calls foo() $func = 'bar'; $func('test'); // This calls bar() $func = 'echoit'; $func('test'); // This calls echoit()
<?php class Foo { function Variable() { $name = 'Bar'; $this->$name(); // This calls the Bar() method } function Bar() { echo "This is Bar"; } } $foo = new Foo(); $funcname = "Variable"; $foo->$funcname(); // This calls $foo->Variable()
当调用静态方法时,函数调用要比静态属性优先: Example #3 Variable 方法和静态属性示例 <?php class Foo { static $variable = 'static property'; static function Variable() { echo 'Method Variable called'; } } echo Foo::$variable; // This prints 'static property'. It does need a $variable in this scope. $variable = "Variable"; Foo::$variable(); // This calls $foo->Variable() reading $variable in this scope.
#353
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" />
苹果手机点击输入框页面自动放大
移动端苹果ios input输入框点击后,页面会缩放,导致显示问题
苹果手机点击输入框时页面自动放大
手机输入框自动变大
#354
const MenuRect = wx.getMenuButtonBoundingClientRect() const statusBarHeight = wx.getSystemInfoSync().statusBarHeight; const height = (MenuRect.top - statusBarHeight) * 2 + MenuRect.height +MenuRect.top
假设某种情况要根据条件改变某个特定值的某个属性,那么就需要先将要改变的属性转换成字符串,再用中括号括起来
//此例假设改变对应index的某个属性值 var temp_str='this.data.family['+index+'].age'; this.setData({ [temp_str]:44 });
npm run build -- --watch
# 安装依赖 # 注意:请切换到子目录下安装 npm install # 本地开发 # 通过 localhost:8080 访问页面 npm run serve # 生产环境构建 npm run build # 代码格式校验 npm run lint
#355
水水水水
#356
#357
#358
<div v-for="(items key index) in list" :key="key"></div>
如果使用v-for循环中的key键值或者index索引值,得到的结果都是无法实现单条数据渲染,只有使用items中的自身属性才可以达到单条数据各自渲染的结果,所以,一般会使用:key="items.id"等items中的属性。 一般来说,使用:key="items.id"的属性有利于代码的优化,减少页面资源消耗
.layui-inline{position: relative; display: inline-block; *display:inline; *zoom:1; vertical-align: middle;}
可以使用“帐户”,但最好是用“账户” 帐号是在网络和多用户操作系统中保存着一种记录,用于记录授权用户的行为。
在 iOS 上,当微信客户端在一定时间间隔内(目前是 5 秒)连续收到两次及以上系统内存告警时,会主动进行小程序的销毁,并提示用户 「该小程序可能导致微信响应变慢被终止」。
#359
#360
微信小程序中的多个空格怎么打?  不行。 在wxml中直接用 decode="{{true}}" 和  ,但是不行。代码语句如下: 部<text decode="{{true}}" space="{{true}}"> </text>门 后来通过下面的方式解决了: 可以打中文全角空格, 如下面的: 复 制 吧 我上面每个字之间都有一个空白字符 具体代码如下: 部 门
public 表示全局,类内部外部子类都可以访问; private表示私有的,只有本类内部可以使用; protected表示受保护的,只有本类或子类或父类中可以访问;
#361
str为要去除空格的字符串:
去除所有空格:
str = str.replace(/\s+/g,"");
$num = 10.4567; //第一种:利用round()对浮点数进行四舍五入 echo round($num,2); //10.46 //第二种:利用sprintf格式化字符串 $format_num = sprintf("%.2f",$num); echo $format_num; //10.46 //第三种:利用千位分组来格式化数字的函数number_format() echo number_format($num, 2); //10.46 //或者如下 echo number_format($num, 2, '.', ''); //10/46