• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP xp_import函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中xp_import函数的典型用法代码示例。如果您正苦于以下问题:PHP xp_import函数的具体用法?PHP xp_import怎么用?PHP xp_import使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了xp_import函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: dirname

<?php

/**
 * Copyright 2010-12 Nickolas Whiting. All rights reserved.
 * Use of this source code is governed by the Apache 2 license
 * that can be found in the LICENSE file.
 */
require_once dirname(realpath(__FILE__)) . '/../__init__.php';
xp_import('unittest');
xp_import('time');
unittest\test(function ($test) {
    $processor = new \XPSPL\Processor();
    $start = time();
    $processor->signal(new \time\SIG_Awake(1, TIME_SECONDS), new \XPSPL\Process(function () use($start, $test) {
        $test->equal(1, time() - $start);
    }, 1));
    $processor->wait_loop();
}, 'Time Module');
开发者ID:prggmr,项目名称:xpspl,代码行数:18,代码来源:time.php


示例2: xp_import

<?php

/**
 * Copyright 2010-12 Nickolas Whiting. All rights reserved.
 * Use of this source code is governed by the Apache 2 license
 * that can be found in the LICENSE file.
 */
require_once '__init__.php';
xp_import('unittest');
unittest\test(function ($test) {
    $db = new \XPSPL\database\Processes();
    $p1 = new \XPSPL\Process(null);
    $p2 = xp_high_priority(new \XPSPL\Process(null));
    $db->install($p1);
    $db->install($p2);
    $db->delete($p1);
    $test->equal($db->count(), 1);
    $test->equal($db->current()->get_priority(), 0);
}, "process delete");
开发者ID:prggmr,项目名称:xpspl,代码行数:19,代码来源:process_delete.php


示例3: xp_import

<?php

namespace network;

/**
 * Copyright 2010-12 Nickolas Whiting. All rights reserved.
 * Use of this source code is governed by the Apache 2 license
 * that can be found in the LICENSE file.
 */
xp_import('logger');
use XPSPL\idle\Process, XPSPL\idle\Time;
/**
 * Socket
 *
 * Event driven I/O.
 */
class Socket extends \XPSPL\SIG_Routine
{
    /**
     * Socket connection object
     *
     * @var  object
     */
    protected $_connection = null;
    /**
     * Socket Address
     *
     * @var  string
     */
    protected $_address = null;
    /**
开发者ID:prggmr,项目名称:xpspl,代码行数:31,代码来源:socket.php


示例4: round

                            $lines++;
                        }
                        if ($_v >= 1) {
                            $total++;
                        }
                    }
                    $avg[$file] = round($total / $lines * 100, 2);
                } else {
                    $avg[$file] = 0;
                }
            }, $_file);
        }
        $total = 0.0;
        foreach ($avg as $_c) {
            $total += $_c;
        }
        \unittest\Output::send('--------------------', \unittest\Output::DEBUG, true);
        \unittest\Output::send(sprintf('Total Test Coverage : %s%%', round($total / (count($avg) * 100) * 100, 2)), \unittest\Output::DEBUG, true);
        \unittest\Output::send('--------------------', \unittest\Output::DEBUG, true);
        foreach ($avg as $_k => $_c) {
            \unittest\Output::send(sprintf('File : %s', $_k), \unittest\Output::DEBUG, true);
            \unittest\Output::send(sprintf('Coverage : %s%%', $_c), \unittest\Output::DEBUG, true);
            \unittest\Output::send('--------------------', \unittest\Output::DEBUG, true);
        }
    });
}
xp_import("unittest");
// load the standard unittest output
unittest\generate_output();
// make sure we save the event history
xp_set_signal_history(true);
开发者ID:prggmr,项目名称:xpspl,代码行数:31,代码来源:__init__.php


示例5: xp_import

<?php

xp_import('time');
xp_import('ftp');
// Must provide username/password
$connection = ['hostname' => 'ftps://app.brickftp.com', 'username' => '-', 'password' => '-', 'secure' => false];
$files = [dirname(realpath(__FILE__)) . '/file_1.txt', dirname(realpath(__FILE__)) . '/file_2.txt', dirname(realpath(__FILE__)) . '/file_3.txt', dirname(realpath(__FILE__)) . '/file_4.txt'];
$uploader = ftp\upload($files, $connection, function ($signal) {
    echo "Upload Started" . PHP_EOL;
});
ftp\complete($uploader, function ($signal) {
    echo $signal->get_file()->get_name() . ' uploaded succesfully' . PHP_EOL;
});
ftp\failure($uploader, function ($signal) {
    echo $signal->get_file()->get_name() . ' failed to upload' . PHP_EOL;
});
开发者ID:prggmr,项目名称:xpspl,代码行数:16,代码来源:upload.php


示例6: xp_import

<?php

/**
 * Copyright 2010-12 Nickolas Whiting. All rights reserved.
 * Use of this source code is governed by the Apache 2 license
 * that can be found in the LICENSE file.
 */
/**
 * Chat Server
 *
 * This example demonstrates how to build a simple TCP chat server which can
 * be connected using telnet.
 */
xp_import('network');
$socket = network\connect('0.0.0.0', ['port' => '8000'], function () {
    echo "Server Running on " . $this->socket->get_address() . PHP_EOL;
});
$socket->on_connect(function (network\SIG_Connect $sig_connect) use($socket) {
    $sig_connect->socket->write("Welcome to the prggmr chat server" . PHP_EOL);
    $sig_connect->socket->write("Enter your username : ");
});
$socket->on_read(null);
$socket->on_read(function (network\SIG_Read $sig_read) use($socket) {
    $clients = $socket->get_connections();
    $client = $clients[intval($sig_read->socket->get_resource())];
    // Strip any newlines from linux
    $sig_read->socket->_read_buffer();
    $content = implode("", explode("\r\n", $sig_read->socket->read()));
    // windows
    $content = implode("", explode("\n\r", $content));
    // On first connection read in the username
开发者ID:prggmr,项目名称:xpspl,代码行数:31,代码来源:chat_server.php



注:本文中的xp_import函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP xpath_eval函数代码示例发布时间:2022-05-23
下一篇:
PHP xoutput_from_array函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap