本文整理汇总了PHP中skip函数的典型用法代码示例。如果您正苦于以下问题:PHP skip函数的具体用法?PHP skip怎么用?PHP skip使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了skip函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: extract_columns
function extract_columns(&$columns, $file, $length)
{
$fp = fopen($file, 'r');
$index = 0;
$z = 0;
$mu = 0;
$dmu = 0;
while ($cols = fgetcsv($fp, 1024, ",")) {
if (empty($cols[0])) {
continue;
}
$pm_count = substr_count($cols[0], "±");
if ($pm_count > 1) {
$index += $pm_count - 1;
$cols[0] = trim(skip($cols[0], " ", 4 * ($pm_count - 1)));
echo $cols[0] . "\n";
}
if ($index == 1) {
$z = $cols[0];
}
if ($index == 6) {
$mu = (double) $cols[0];
$dmu = trim(substr($cols[0], strpos($cols[0], "±") + 2));
}
if ($index >= $length - 1) {
$index = 0;
$columns[] = array($z, $mu, $dmu);
} else {
++$index;
}
}
}
示例2: test_skip_one
function test_skip_one()
{
$input = [0, 1, 2];
$expect = [1 => 1, 2 => 2];
$skip = skip(1);
$actual = iterator_to_array($skip($input));
$this->assertEquals($expect, $actual);
}
示例3: setup
function setup()
{
if (!extension_loaded('apc')) {
skip('apc required.');
}
if (!ini_get('apc.enable_cli')) {
skip('apc.enable_cli required');
}
}
示例4: setUp
function setUp()
{
if (!extension_loaded('geoip')) {
skip('geoip extension is required.');
}
if (!dns_get_record('www.hinet.net')) {
skip('networking is required.');
}
}
示例5: testDetectProcessorNumber
public function testDetectProcessorNumber()
{
$machine = new MachineForTest();
if (!$machine->detectProcessorNumber()) {
skip();
}
ok($machine->detectProcessorNumber() > 0);
is($machine->detectProcessorNumber(), $machine->detectProcessorNumberByNproc() || $machine->detectProcessorNumberByGrep());
}
示例6: test_skip_all
function test_skip_all()
{
$skip = skip(function ($value) {
return $value % 2 > 0;
});
$input = [1, 3, 5];
$expect = [];
$actual = iterator_to_array($skip($input));
$this->assertEquals($expect, $actual);
}
示例7: test
public function test()
{
if (!TputConsoleInfo::hasSupport()) {
skip('tput is not supported.');
}
$info = new TputConsoleInfo();
ok($info);
ok($info->getColumns());
ok($info->getRows());
}
示例8: test
public function test()
{
if (!EnvConsoleInfo::hasSupport()) {
skip('env console info is not supported.');
}
$info = new EnvConsoleInfo();
ok($info);
ok($info->getColumns());
ok($info->getRows());
}
示例9: _registerAct
/**
* 注册
*/
public function _registerAct()
{
if (empty($_POST) || empty($_POST['mobile']) || empty($_POST['pwd'])) {
return 0;
}
$phone = V('mobile');
$pwd = $_POST['pwd'];
$rec = V('recommended');
$telcode = V('telcode');
$data = array('sname' => 'user.reg', 'mobile' => $phone, 'passwd' => $pwd, 'recommended' => $rec, 'telcode' => $telcode);
$data = transferAPI($data);
if ($data['code'] != 0) {
$this->view->assign('n', $phone);
$this->view->assign('msg', $data['msg']);
} else {
skip('/user/login');
}
}
示例10: zpm_postamble
function zpm_postamble($ggame)
{
if (skip()) {
return;
}
global $zpm_utime;
$end_t = microtime(true);
$time_t = floor(($end_t - $zpm_utime) * 1000000);
$start_t_f = floor($zpm_utime);
$name = basename($_SERVER['SCRIPT_NAME']);
if (isset($ggame) && $ggame != "") {
$name = $ggame . "^" . $name;
}
log_entry($name, $time_t, $start_t_f);
zperfmon_disable();
$zpm_utime = ZPM_INIT_VAL;
return;
}
示例11: _loginAct
public function _loginAct()
{
$phone = V('mobile');
$pas = $_POST['pwd'];
if (empty($phone) || empty($pas)) {
return 0;
}
$data = array('sname' => 'user.login', 'mobile' => $phone, 'passwd' => $pas);
core::Singleton('comm.remote.remote');
$result = remote::send($data);
setcookie("version", remote::$session_id, time() + 3600 * 12, '/', 'cailai.com');
$data = json_decode($result, TRUE);
if ($data['code'] != 0) {
$this->view->assign('tipMsg', $data['msg']);
}
setcookie("uid", md5(uniqid()) . $data['data']['mobile'], time() + 3600 * 12, '/', 'cailai.com');
if (empty(remote::$session_id)) {
$this->view->assign('n', $phone);
return 0;
} else {
skip();
}
}
示例12: connect
include_once 'inc/config.inc.php';
include_once 'inc/mysql.inc.php';
include_once 'inc/tool.inc.php';
$link = connect();
if (!($member_id = is_login($link))) {
skip('login.php', 'error', '请登录之后再发帖!');
}
if (isset($_POST['submit'])) {
include 'inc/check_publish.inc.php';
$_POST = escape($link, $_POST);
$query = "insert into cfc_content(module_id,title,content,time,member_id) values({$_POST['module_id']},'{$_POST['title']}','{$_POST['content']}',now(),{$member_id})";
execute($link, $query);
if (mysqli_affected_rows($link) == 1) {
skip('publish.php', 'ok', '发布成功!');
} else {
skip('publish.php', 'error', '发布失败,请重试!');
}
}
$template['title'] = '帖子发布页';
$template['css'] = array('style/public.css', 'style/publish.css');
include 'inc/header.inc.php';
?>
<div id="position" class="auto">
<a href="index.php">首页</a> > 发布帖子
</div>
<div id="publish">
<form method="post">
<select name="module_id">
<option value='-1'>请选择一个子版块</option>
<?php
$where = '';
示例13: execute
$result_memebr = execute($link, $query);
$data_member = mysqli_fetch_assoc($result_memebr);
if (isset($_POST['submit'])) {
$save_path = 'uploads' . date('/Y/m/d/');
//写上服务器上文件系统的路径,而不是url地址
$upload = upload($save_path, '8M', 'photo');
if ($upload['return']) {
$query = "update cfc_member set photo='{$upload['save_path']}' where id={$member_id}";
execute($link, $query);
if (mysqli_affected_rows($link) == 1) {
skip("member.php?id={$member_id}", 'ok', '头像设置成功!');
} else {
skip('member_photo_update.php', 'error', '头像设置失败,请重试');
}
} else {
skip('member_photo_update.php', 'error', $upload['error']);
}
}
//SUB_URL.
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<title></title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<style type="text/css">
body {
font-size:12px;
font-family:微软雅黑;
示例14: setUp
public function setUp()
{
if (!extension_loaded('pdo')) {
return skip('pdo extension is required');
}
// XXX: check pdo driver
# if( ! extension_loaded('pdo_pgsql') )
# return skip('pdo pgsql required');
if ($driverType = $this->getCurrentDriverType()) {
$this->pdo = $this->createConnection($driverType);
} else {
throw new Exception("Please define driver type for testing.");
}
if (!$this->pdo) {
throw new Exception("Can not create PDO connection: " . get_class($this));
}
// throw Exception on Error.
$this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$this->setupSchema();
ok($this->pdo);
}
示例15: skip
skip('index.php', 'ok', '您已经登录,请不要重复登录!');
}
if (isset($_POST['submit'])) {
include_once 'inc/check_login.inc.php';
$_POST = escape($link, $_POST);
$query = "select * from cfc_manage where name='{$_POST['name']}' and pw=md5('{$_POST['pw']}')";
$result = execute($link, $query);
if (mysqli_num_rows($result) == 1) {
$data = mysqli_fetch_assoc($result);
$_SESSION['manage']['name'] = $data['name'];
$_SESSION['manage']['pw'] = sha1($data['pw']);
$_SESSION['manage']['id'] = $data['id'];
$_SESSION['manage']['level'] = $data['level'];
skip('index.php', 'ok', '登录成功!');
} else {
skip('login.php', 'error', '用户名或者密码错误,请重试!');
}
}
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<title>后台登录</title>
<meta name="keywords" content="后台登录" />
<meta name="description" content="后台登录" />
<style type="text/css">
body {
background:#f7f7f7;
font-size:14px;
}