html:
     <div class="col-xs-5 col-sm-4">
       <input type="button"  class="form-control inpt4" id="fsyzm" value="发送验证码">
    </div>


js:

$('#fsyzm').click(function(){
  layer.open({
    title:'请输入验证码',
    type: 1,
    // skin: 'layui-layer-rim', //加上边框
    area: ['300px', '160px'], //宽高
    content: '<div class="layui-layer-prompt" style="overflow: hidden;margin-top:20px;"><input type="text" class="layui-layer-input yzmvalue" style="width:70px;float:left;margin-right:10px;margin-left:10px;height:40px;"><img src="checkcode.php"  onclick="this.src=\'checkcode.php?\'+new Date().getTime();" width="100" height="40" style="float:left;"><div class="layui-layer-btn layui-layer-btn-" style="float:left"><a class="layui-layer-btn0 yzmtj">确定</a></div></div>'
  });
})



$('body').on('click','.yzmtj',function(){
  if($('.yzmvalue').val()!='')
  {
    $.ajax({
      url:'wapi.php',
      type:"POST",
      data:{'a':'sms','txyzm':$('.yzmvalue').val(),'sjh':$('#sjh').val()},
      success:function(result){
        if(result.code == 1)
        {
          settime('#fsyzm');
          layer.alert('验证码已发送!',{icon: 1,});
        }
        else{
          layer.alert('验证码发送失败!',{icon: 7,});        
        }
        
      }
    })
  }
  else
  {
    layer.alert('请输入验证码',{icon: 7,});
  }
})