本文整理汇总了PHP中resource::send方法的典型用法代码示例。如果您正苦于以下问题:PHP resource::send方法的具体用法?PHP resource::send怎么用?PHP resource::send使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类resource
的用法示例。
在下文中一共展示了resource::send方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exec
/**
* Execute command
*
* @return \LWMail\Protocol (this)
*/
protected final function exec()
{
$this->data = array();
$this->raw_data = array();
$this->has_error = false;
foreach ($this->command_stack as $name => $data) {
$result = "";
$response = "";
$commands = $data['commands'];
$eof = $data['eof'];
if (!is_array($commands) || empty($commands)) {
continue;
}
$eol = $this->getOption('eol', "\r\n");
if ($result = $this->stream->send(join($eol, $commands) . $eol)) {
$result = $this->stream->getline($response, $eof);
}
$this->has_error = !$result || $this->has_error;
$this->raw_data[$name] = $response;
$method = "parse" . join('', array_map('ucfirst', explode('_', strtolower($name))));
if (method_exists($this, $method)) {
$result = $this->{$method}($response, $this->data[$name]);
$this->has_error = !$result || $this->has_error;
}
}
$this->command_stack = array();
return $this;
}
示例2: sendData
/**
* 发送数据给服务端
*
* @param string $method
* @param array $arguments
*/
public function sendData($method, $arguments)
{
$bin_data = JsonProtocol::encode(array('class' => $this->serviceName, 'method' => $method, 'param_array' => $arguments)) . "\r\n";
$this->openConnection();
if (self::$useSwoole) {
return $this->swooleClient->send($bin_data);
} else {
return fwrite($this->connection, $bin_data) == strlen($bin_data);
}
}
示例3: strtolower
/**
* Check that the file hasn't already been seen
* @param array $info The music files tag data
* @return boolean
*/
function duplicate_check($info)
{
$query = strtolower($info['artist'] . '/' . $info['album'] . '/' . $info['title']);
if (in_array($query, $this->musicDuplicates)) {
$this->Output->send(' %5- Duplicate Song File%n');
return TRUE;
} else {
$this->musicDuplicates[] = $query;
return FALSE;
}
}
示例4: explode
/**
* Create folders recursively
* @param string $finalFolder The files destined location
* @param string $niceFolderName The string to remove to shorten the folder name when sent to screen
* @return string
*/
function recursive_mkDir($finalFolder, $niceFolderName = '')
{
//Create the new folders if and where required
$finalFolder = str_replace($this->illegalChars, '', $finalFolder);
$finalFolder = explode('/', substr($finalFolder, 0, strrpos($finalFolder, '/')));
$appendFolder = '';
foreach ($finalFolder as $folder) {
$mkDir = $appendFolder . $folder;
if ($mkDir != '' && file_exists($mkDir) == FALSE) {
mkdir($mkDir);
$this->Output->send('%3Making folder: ' . str_replace($niceFolderName, '', $mkDir) . '%n');
}
$appendFolder .= $folder . '/';
}
return $appendFolder;
}
示例5: disconnect
/**
* Desconnects from SMSC/SMS gateway gracefully
* @access public
* @return boolean Always TRUE
*/
public function disconnect()
{
if ($this->state == ESS_BIND_TX || $this->state == ESS_BIND_RX) {
l('ESME sending UNBIND command...');
$this->sock->send($this->form_pdu(UNBIND));
$pdu = $this->sock->pdu_wait_for(UNBIND | ACK, $this->sqn);
$res = $this->parse_pdu_header(substr($pdu, 0, 16));
if ($res['stat'] !== 0) {
l('UNBIND failed: ' . $res['stat'] . '.', L_WARN);
} else {
l('UNBIND done.');
}
}
$this->state = ESS_DISCONNECTED;
$this->sock->disconnect();
return true;
}
示例6: log
/**
* Logs the current command
*
* @access public
* @param resource $rpc_conn The connection resource
* @param array $auth Array of authentication information (email, password)
* @param string $command The command used to run this script.
*/
function log($rpc_conn, $auth, $command)
{
$command = base64_encode($command);
$msg = new XML_RPC_Message("logCommand", array(new XML_RPC_Value($auth[0], 'string'), new XML_RPC_Value($auth[1], 'string'), new XML_RPC_Value($command, 'string')));
$result = $rpc_conn->send($msg);
if ($result->faultCode()) {
Command_Line::quit($result->faultString());
}
}