本文整理汇总了PHP中pr函数的典型用法代码示例。如果您正苦于以下问题:PHP pr函数的具体用法?PHP pr怎么用?PHP pr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_article_asc
public function get_article_asc()
{
$query = "SELECT * FROM Aset ORDER BY Aset_ID ASC LIMIT 2";
pr($query);
// $result = $this->fetch($query,0);
// return $result;
}
示例2: beforeFilter
/**
* beforeFilter
*
* @param \Cake\Event\Event $event Event instance
* @return void
*/
public function beforeFilter(Event $event)
{
pr("AppPlusPlus component beforeFilter()");
// no special action neeeded
if ($this->_controller->request->is('api')) {
return;
}
// Disallow access to actions that don't make sense after being logged in.
$allowed = ['Accounts' => ['login', 'lost_password', 'register']];
// return for now, until we integrate user model into plugin or require
// it in the application.
if (empty($this->_controller->Auth->user('id'))) {
return;
}
//if (!$this->_controller->AuthUser->id()) {
if (!$this->_controller->Auth->user('id')) {
return;
}
// disallow access to actions that don't make sense after the user has
// already logged in.
foreach ($allowed as $controller => $actions) {
if ($this->name === $controller && in_array($this->request->action, $actions)) {
$this->Flash->message('The page you tried to access is not relevant if you are already logged in. Redirected to main page.', 'info');
return $this->redirect($this->_controller->Auth->config('loginRedirect'));
}
}
}
示例3: createAction
public function createAction()
{
/**
$authentication = new AuthenticationService(Application $app);
$authentication->setController($controller);
$authentication->setEntityClass('\Application\Model\Entity\Client');
$auth = $this->get('service_locator')->locate('auth', $this);
excel = $this->get('service_locator')->locate('excel', $options);
$auth->get('token');
*/
$formBulder = $this->get('form.factory');
$client = new Client();
$ClientForm = $formBulder->createBuilder(new ClientType(), $client)->getForm();
$clientUser = new ClientUser();
$UserClientForm = $formBulder->createBuilder(new ClientUserType($this->get('doctrine.entity_manager')), $clientUser)->getForm();
$ClientForm->handleRequest($this->request);
$UserClientForm->handleRequest($this->request);
if ($this->request->isMethod('post')) {
pr($client);
pr($clientUser);
exit;
}
return $this->render('Application::Client::create', array('form_client' => $ClientForm->createView(), 'form_client_user' => $UserClientForm->createView()));
}
示例4: __construct
public function __construct()
{
//session_start();
session_start();
$this->_db = DB::getInstance();
//$this->_sessionName = Config::get('session/session_name');
//$this->_cookieName = Config::get('remember/cookie_name');
$this->url = $this->parseUrl();
pr($this->parsedUrl);
//$this->constructCAV();
/*
require_once APP_PATH.DS.'controllers'.DS.$this->controller.'.php';
$this->controller = new $this->controller;
if (method_exists($this->controller, $this->method)
&& is_callable(array($this->controller, $this->method)))
{
call_user_func_array(array($this->controller,$this->method),array($this->param));
} else {
die_err(500,'err_50928');
}
*
*/
}
示例5: processQueueCallback
/**
* ->processQueueCallback(function (\Dja\Db\Model\Metadata $metadata, \Doctrine\DBAL\Schema\Table $table, array $sql, \Doctrine\DBAL\Connection $db) {})
* @param callable|\Closure $callBack
*/
public function processQueueCallback(\Closure $callBack)
{
$callbackQueue = [];
while (count($this->generateQueue)) {
$modelName = array_shift($this->generateQueue);
try {
/** @var Metadata $metadata */
$metadata = $modelName::metadata();
$tblName = $metadata->getDbTableName();
if ($this->db->getSchemaManager()->tablesExist($tblName)) {
continue;
}
if (isset($this->generated[$tblName])) {
continue;
}
$table = $this->metadataToTable($metadata);
$this->generated[$tblName] = 1;
$sql = $this->dp->getCreateTableSQL($table, AbstractPlatform::CREATE_INDEXES);
array_unshift($callbackQueue, [$metadata, $table, $sql]);
$fks = $table->getForeignKeys();
if (count($fks)) {
$sql = [];
foreach ($fks as $fk) {
$sql[] = $this->dp->getCreateForeignKeySQL($fk, $table);
}
array_push($callbackQueue, [$metadata, $table, $sql]);
}
} catch (\Exception $e) {
pr($e->__toString());
}
}
foreach ($callbackQueue as $args) {
$callBack($args[0], $args[1], $args[2], $this->db);
}
}
示例6: testQuickSort
public function testQuickSort()
{
$is = $this->Sort->quickSort($this->examples[0]);
$expected = array(1, 2, 3, 4, 6, 11, 16, 50, 58, 66, 69, 99);
pr($is);
$this->assertEquals($is, $expected);
}
示例7: lvFeeCC
public function lvFeeCC()
{
global $db;
$objResto = new MasterRestaurantModel();
$q = "SELECT name, cc_fee FROM {$objResto->table_name} ORDER BY cc_fee DESC ";
$arrQuery = $db->query($q, 2);
pr($arrQuery);
$t = time();
?>
<h2>
List view Restaurant (Fee Credit Card)
</h2>
<div class="table-responsive">
<table id="table_lvCC_<?php
echo $t;
?>
" class="table table-bordered table-striped table-hover crud-table"
style="background-color: white;">
<tbody>
<tr>
<th id="h_id_name_<?php
echo $t;
?>
">Restaurant</th>
<th id="h_id_discount_<?php
echo $t;
?>
">Fee</th>
</tr>
<?php
foreach ($arrQuery as $key => $val) {
?>
<tr id="lv_<?php
echo $val->name . $t;
?>
">
<td id="restaurant_<?php
echo $val->name . $t;
?>
"> <?php
echo $val->name;
?>
</td>
<td id="disc_<?php
echo $val->name . $t;
?>
"> <?php
echo $val->cc_fee;
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php
}
示例8: login
public function login($__user = null, $password = null, $remember = false)
{
if (!$__user && !$password && $this->exists()) {
Session::put($this->_sessionName, $this->data()->id);
} else {
$user = $this->find($__user);
}
if ($user) {
if ($this->data()->password === Hash::make($password, $this->data()->salt)) {
Session::put($this->_sessionName, $this->data()->id);
$remember = true;
if ($remember) {
//echo 'remember!';
$hash = Hash::unique();
$hashCheck = $this->_db->get('user_sessions', array('user_id', '=', $this->data()->id));
if (!$hashCheck->count()) {
$this->_db->insert('user_sessions', array('user_id' => $this->data()->id, 'hash' => $hash));
} else {
$hash = $hashCheck->first()->hash;
}
Cookie::put($this->_cookieName, $hash, Config::get('remember.cookie_expiry'));
}
return true;
} else {
pr('NO PASS');
}
}
return false;
}
示例9: listAttachments
/**
*
* @param <type> $attachments
* @return string html block of attachments
*/
public function listAttachments($attachments = array())
{
if (empty($attachments) || !is_array($attachments)) {
return false;
}
$return = array();
foreach ($attachments as $attachment) {
switch ($attachment['type']) {
case 'jpeg':
case 'gif':
$data = $this->__imageAttachment($attachment);
break;
case 'msword':
case 'pdf':
$data = $this->__fileAttachment($attachment);
break;
default:
pr($attachment);
exit;
break;
}
$return[] = $this->__addAttachment($attachment, $data);
}
if (!empty($return)) {
return sprintf('<ul class="attachments"><li>%s</li></ul>', implode('</li><li>', $return));
}
return false;
}
示例10: sendMail
public function sendMail()
{
$mailer = new Email();
$mailer->transport('smtp');
$email_to = 'xuan@bliss-interactive.com';
$replyToEmail = "xuan@bliss-interactive.com";
$replyToEmailName = 'Info';
$fromEmail = "noreply@bliss-interactive.net";
$fromEmailName = "Xuan";
$emailSubject = "Demo mail";
//$view_link = Router::url('/', true);
$params_name = 'XuanNguyen';
$view_link = Router::url(['language' => $this->language, 'controller' => 'frontend', 'action' => 'view_email', 'confirmation', $params_name], true);
$sentMailSatus = array();
if (!empty($email_to)) {
//emailFormat text, html or both.
$mailer->template('content', 'template')->emailFormat('html')->subject($emailSubject)->viewVars(['data' => ['language' => $this->language, 'mail_template' => 'confirmation', 'email_vars' => ['view_link' => $view_link, 'name' => $params_name]]])->from([$fromEmail => $fromEmailName])->replyTo([$replyToEmail => $replyToEmailName])->to($email_to);
if ($mailer->send()) {
$sentMailSatus = 1;
} else {
$sentMailSatus = 0;
}
}
pr($sentMailSatus);
exit;
}
示例11: mailqueue_callback
function mailqueue_callback($args)
{
if (!$args) {
echo "NOT ARGS IN CALLBACK:";
pr($args);
die;
//return false;
}
global $container_options;
$log = array();
$log['args'] = $args;
$contanier = new Mail_Queue_Container_db($container_options);
$obj = $contanier->getMailById($args['id']);
if (!$obj) {
echo "NOT OBJ IN CALLBACK:";
pr($obj);
die;
//return false;
}
$log['mailObject'] = (array) $obj;
$headers = $obj->headers;
$subject = $obj->headers['Subject'];
$body = $obj->body;
$mail_headers = '';
foreach ($headers as $key => $value) {
$mail_headers .= "{$key}:{$value}\n";
}
$mail = $mail_headers . "\n" . $body;
$decoder = new Mail_mimeDecode($mail);
if (!$decoder) {
echo "NOT DECODER IN CALLBACK";
pr($decoder);
die;
//return false;
}
$decoded = $decoder->decode(array('include_bodies' => TRUE, 'decode_bodies' => TRUE, 'decode_headers' => TRUE));
$body = $decoded->body;
$esmtp_id = $args['queued_as'];
if (isset($args['greeting'])) {
$greeting = $args['greeting'];
$greets = explode(' ', $greeting);
$server = $greets[0];
} else {
$server = 'localhost';
}
$log['serverResponse'] = compact('server', 'esmtp_id');
$res = sq("update mail_queue set log = '" . serialize($log) . "' where id = " . $args['id']);
if (!$res) {
echo "NOT RES IN CALLBACK";
pr($res);
die;
//return false;
}
if (CRON) {
echo "Email ID " . $args['id'] . "\n";
echo "Log:\n\n";
print_r($log);
echo "\n\n";
}
}
示例12: testEvent
/**
* test if things are working
*/
public final function testEvent()
{
echo '<h1>your event is working</h1>';
echo '<p>The following events are available for use in the Infinitas core</p>';
pr($this->availableEvents());
exit;
}
示例13: create
function create()
{
$dir = new Folder(APP);
$files = $dir->findRecursive('.*');
$data_array = array();
foreach ($files as $file) {
$file_parts = pathinfo($file);
if (isset($file_parts['extension']) && ($file_parts['extension'] == "php" || $file_parts['extension'] == "ctp")) {
$data = file_get_contents($file);
$pattern = "~(__\\('|__\\(\")(.*?)(\\'\\)|\",|\\',|\"\\)|\" \\)|\\' \\))~";
preg_match_all($pattern, $data, $matches);
$data_array = array_filter(array_merge($data_array, $matches[2]));
}
}
$data_array = array_unique($data_array);
pr($data_array);
$filename = 'adefault.po';
$file = new File(APP . "/Locale" . DS . $filename);
foreach ($data_array as $string) {
$file->write('msgid "' . $string . '"' . "\n");
$file->write('msgstr "' . $string . '"' . "\n\n");
echo $string;
}
$file->close();
die;
}
示例14: upgrade
/**
* upgrade method
*
* Using reflection API retrieve list of methods, that have `@since` comment
* set to value no lower than requested version and call these methods.
*
* @param int $target_ver Target version, to upgrade to
*
* @return bool Success
*/
public function upgrade($target_ver = NULL)
{
if (NULL === $target_ver) {
$target_ver = AI1EC_DB_VERSION;
}
$target_ver = (int) $target_ver;
$curr_class = get_class($this);
$reflection = new ReflectionClass($this);
$method_list = $reflection->getMethods(ReflectionMethod::IS_PUBLIC);
$since_regex = '#@since\\s+(\\d+)[^\\d]#sx';
foreach ($method_list as $method) {
if ($method->getDeclaringClass()->getName() !== $curr_class || ($name = $method->getName()) === __FUNCTION__) {
continue;
}
$doc_comment = $method->getDocComment();
if (!preg_match($since_regex, $doc_comment, $matches)) {
continue;
}
$since = (int) $matches[1];
try {
if ($since <= $target_ver && !$this->{$name}()) {
return false;
}
} catch (Ai1ec_Database_Schema_Exception $exception) {
pr((string) $exception);
return false;
}
}
return true;
}
示例15: index
public function index()
{
$data = $this->testimonial_model->get_testimonial();
pr($data['data']);
echo "<br>";
echo $data['nav'];
}