php知识点滴

//   进度条的简单实现

echo '<script type="text/javascript">$("#jd").text("'1/100'");</script>';

ob_flush();

flush();


// 写日志文件

function mylog($logthis){
    file_put_contents('myDebugLog.log', $logthis. "\r\n", FILE_APPEND | LOCK_EX);
}


// 读取文件

$file_path = "myDebugLog.log";
if(file_exists($file_path)){
        $file_arr = file($file_path);
        //逐行读取文件内容

        for($i = 0; $i < count($file_arr); $i++)

       {

            echo $file_arr[$i]."\n";

      }

}


// 使用php脚本执行时间不受限制

set_time_limit(0);


// 函数多返回值

function getDate()

{

return array(1,2,3);

}

      

// 接收jquery中文乱码的处理

  $reason = urldecode($_POST['reason']);
  $reason = iconv("UTF-8", "GBK",  $reason);    


// 执行时间不受限制

  set_time_limit(0);   


//error_reporting(E_ALL);  
error_reporting(E_ALL || ~E_NOTICE); //显示除去 E_NOTICE 之外的所有错误信息


// 获取命令行的参数$argv, 这是一个数组,里面含有参数内容

// 获取命令行的参数$argc, 这是一个变量,里面含有参数个数   

// 排序多维数组

function cmp($a, $b) {
      $a1 = $a['age'];
      $b1 = $b['age'];
      if ($a1 == $b1){
        return 0;
      }
      return ($a1 < $b1) ? -1 : 1;
};

$users = array(
  array('name' => 'tom', 'age' => '20')
  , array('name' => 'anny', 'age' => '18')
  , array('name' => 'jack', 'age' => '22')
);

usort($users, "cmp");


// 表单自提交

html的代码片段


    <form method='post' active='tj.php'>

。。。

<input class="advert_btn" type="submit" name="submit" id="rebuild" value="提交" />

。。。

   </form>


对应php的代码片段

。。。。 // a

if if (isset($_POST['submit'])) {

// b

}

......// c

说明:提交时才会执行注释b中的代码


时间戳转换为日期: date()

例:date('Y-m-d H:i:s', 1533779101);

日期转换为时间戳: strtotime

例:strtotime('2017-08-08 01:01:01')


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值