TEL----电话
TITLE---职位
ROLE---职称
N----姓名
ORG----组织
ADR----地址
EMAIL---邮箱
URL----个人主页

在处理订单编号的时候,需要固定位数的数字,比如需要固定四位数格式

1->0001
56->0056
288->0288
1992->1992

可以使用php内置函数str_pad() 函数把字符串填充为新的长度。

str_pad(string,length,pad_string,pad_type)
//参数 描述
string //必需。规定要填充的字符串。
length //必需。规定新的字符串长度。如果该值小于字符串的原始长度,则不进行任何操作。
pad_string //可选。规定供填充使用的字符串。默认是空白。
pad_type //可选。规定填充字符串的哪边。

        //可能的值:
        STR_PAD_BOTH - //填充字符串的两侧。如果不是偶数,则右侧获得额外的填充。
        STR_PAD_LEFT - //填充字符串的左侧。
        STR_PAD_RIGHT - //填充字符串的右侧。默认。

例子:

$num=128;
$num=str_pad($num,4,"0",STR_PAD_LEFT);
echo $num;

输出
0128

问题:navigator和tabBar同样URL地址无法使用的问题。详细查看【网页地址

当url和tabar的地址一致时候,navgator要增加open-type="switchTab"的属性。

  <navigator url="/pages/loan/index" open-type="switchTab">
            <text class="txt">地址一</text>
          </navigator>

其他情况,可加open-type="navigate",默认情况下也是这个属性

  <navigator url="/pages/loan/index" open-type="navigate">
            <text class="txt">地址二</text>
          </navigator>

wxml代码

<view class="notice">
<view class="title">公告:</view>
<swiper class="swiper_container" vertical="true" autoplay="true" circular="true" interval="2000">
    <block wx:for="{{msgList}}" wx:key="{{item}}">
      <navigator url="/pages/index/index?title={{item.url}}" open-type="navigate">
        <swiper-item>
          <view class="swiper_item">{{item.title}}</view>
        </swiper-item>
      </navigator>
    </block>
  </swiper>
  </view>

数据js

msgList: [
{ url: "url", title: "多地首套房贷利率上浮 热点城市渐迎零折扣时代" },
{ url: "url", title: "悦如公寓三周年生日趴邀你免费吃喝欢唱城市渐迎零折扣时代" },
{ url: "url", title: "你想和一群有志青年一起过生日嘛?" }],
wxss样式

.notice {
 width: 750rpx;
 position: relative;
 margin-top:12rpx;
 }
.notice .title{
 width: 151rpx; 
 float: left;
 text-align: center;
 font-size: 30rpx;
 line-height:55rpx;
}
.notice .swiper_container {
height: 55rpx;
width: 600rpx;
line-height:55rpx;
float: right;
}