本文整理汇总了PHP中P函数的典型用法代码示例。如果您正苦于以下问题:PHP P函数的具体用法?PHP P怎么用?PHP P使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了P函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetch
public function fetch($viewfile = '', $display = false)
{
$content = "";
if (!I("view")) {
//检查有没有自己设置的主题
if (isset($GLOBALS['config']['theme']) && file_exists($GLOBALS['config']['theme'] . "/" . $viewfile . ".php")) {
$viewfile = $GLOBAL['config']['theme'] . "/" . $viewfile . ".php";
} elseif (file_exists(P("webprojectpath") . "view/" . $viewfile . ".php")) {
$viewfile = P("webprojectpath") . "view/" . $viewfile . ".php";
} elseif (file_exists(P("webprojectpath") . "view/" . C("router")->controller . "/" . $viewfile . ".php")) {
$viewfile = P("webprojectpath") . "view/" . C("router")->controller . "/" . $viewfile . ".php";
} elseif (file_exists(P("viewpath") . "view/" . $viewfile . ".php")) {
$viewfile = P("viewpath") . "view/" . $viewfile . ".php";
} elseif (file_exists(P("viewpath") . "view/" . C("router")->controller . "/" . $viewfile . ".php")) {
$viewfile = P("viewpath") . "view/" . C("router")->controller . "/" . $viewfile . ".php";
}
ob_start();
ob_implicit_flush(0);
extract($this->vvar, EXTR_OVERWRITE);
include $viewfile;
$content = ob_get_clean();
} elseif (I("view") == "Smarty") {
$Smarty = C("Smarty");
$Smarty->assign($this->vvar);
$content = $Smarty->fetch($viewfile);
}
return $content;
}
示例2: __construct
function __construct($path = "", $waterfilname = 'site_water.png', $width = 120, $height = 25)
{
$this->waterpath = $path ? $path : P("frameworkpath") . "config/";
$this->waterfilename = $waterfilname;
$this->width = $width;
$this->height = $height;
$this->bgcolor = '#F0F0F0';
}
示例3: initialize_request
function initialize_request()
{
global $MODULE, $PAGE, $OP, $F, $S;
$MODULE = P('m');
$PAGE = P('p');
$OP = P('op');
$F = P('f', array());
$S = P('s', array());
}
示例4: __construct
public function __construct($message, $code = 0)
{
// 自定义的代码
// 确保所有变量都被正确赋值
parent::__construct($message, $code);
ob_start();
print_r($GLOBALS);
$str = "\n-----------------------------------" . $this->getCode() . "----------------------------------------\n";
file_put_contents(P("frameworkpath") . "log/" . date("Y_m_d") . ".txt", $str . ob_get_clean() . $this->__toString() . $str, FILE_APPEND);
}
示例5: edit_user
function edit_user(&$msg, &$data)
{
global $F;
$id = P('id');
if (!$id || $id == '1') {
return false;
}
// just for demo of file upload
unset($F['avatar']);
db_update('qwp_user')->fields($F)->condition('id', $id)->execute();
$msg = L('Save user info successfully');
}
示例6: search
protected function search($e)
{
$q = $this->post->textVal('txtQuery');
// load remote html page
$url = $this->url . urlencode($q);
$searchPage = new RaxanWebPage($url);
// find the search titles (h3)
$titles = $searchPage->find('h3');
$html = '';
foreach ($titles->get() as $node) {
$html .= '<div class="bmm">' . P($node)->html() . "</div>\n";
//
}
$this->result->html($html);
}
示例7: list_users
function list_users(&$msg, &$data)
{
$r = intval(S('r', 0));
$page = intval(P('page', 1));
$page_size = intval(P('psize', 30));
$page *= $page_size;
$data['total'] = 5 * $page_size;
$data['data'] = array();
for ($i = 0; $i < $page_size; ++$i) {
if ($i < $r) {
continue;
}
$data['data'][] = array('id' => $i, 'name' => 'Test ' . ($i + $page - $page_size + 1), 'age' => rand(10, 30), 'phone' => random_string());
usleep(30000);
}
}
示例8: Main
function Main()
{
$now = Date("Y-m-d H:i:s");
P($now . "==============================\n");
global $tbl_gm_db, $tbl_serv_db, $tbl_game_server;
$str = "(";
$qs = "select * from tbl_channel_word";
$result = MySQLQuery($qs, "GMS");
$words = array();
while ($row = mysql_fetch_row($result)) {
array_push($words, "lcc.lcc_sMsg like '%" . $row[0] . "%'");
}
$str .= implode(" or ", $words);
$str .= ")";
P("Number of Check Word: " . count($words) . "\n");
$qs = "select gv_value from tbl_gm_variable where gv_name = 'ChannelChatStemp'";
$result = MySQLQuery($qs, "GMS");
if ($row = mysql_fetch_row($result)) {
P("Last updated at: " . $row[0] . "\n");
$str .= " and lcc.lcc_dtChatTime > '" . $row[0] . "' and lcc.lcc_dtChatTime <= '" . $now . "'";
}
$qs = "update tbl_gm_variable set gv_value = '" . $now . "' where gv_name = 'ChannelChatStemp'";
MySQLQuery($qs, "GMS");
foreach ($tbl_serv_db as $key => $dbinfo) {
P("Server: " . $key . "\t");
$insert = array();
$qs = "select lcc.cs_uId,lcc.lcc_dtChatTime,{$key} as serv_id,lcc.lcc_sMsg,lcc.lcc_sChannelName from tbl_log_channel_chat lcc where " . $str;
$result = MySQLQuery($qs, "GameLog", $key);
while ($row = mysql_fetch_row($result)) {
$qs = "select c.c_sName, us.us_sName from tbl_char c, tbl_char_static cs, tbl_user_static us where c.cs_uId = cs.cs_uId and cs.us_uId = us.us_uId and cs.cs_uId = " . $row[0];
$rs = MySQLQuery($qs, "Game", $key);
if ($r = mysql_fetch_row($rs)) {
$row[0] = $r[0];
$user_name = $r[1];
} else {
$row[0] = "[" . $row[0] . "]";
}
array_push($insert, "insert into tbl_channel_chat values('" . $row[0] . "','" . $row[3] . "','" . $row[1] . "','" . Local2UTF8($row[4]) . "'," . $row[2] . ",'" . $user_name . "')");
}
P("Number of Chat: " . count($insert) . "\n");
foreach ($insert as $query) {
MySQLQuery($query, "GMS");
}
}
}
示例9: list_users
function list_users(&$msg, &$data)
{
get_user_data_modal($user_modal);
$user_id = P('id');
$options = array('data modal' => $user_modal, 'left join' => array(array('qwp_role', 'r', 'r.id=u.role')), 'where' => 'u.id<>1 and role<>1');
if ($user_id) {
$data = array();
if ($user_id != '1' && is_digits($user_id)) {
$options['where'] .= ' and u.id=' . $user_id;
qwp_db_get_data(array('qwp_user', 'u'), $data, null, $options);
}
} else {
$options['default order'] = array('role', array('id', 'desc'));
$options['search condition'] = array('condition' => array('fields' => array('u.name' => 'like', 'avatar' => 'set_avatar_condition', 'gender' => array('s' => array('<>', 'x'))), 'condition' => array('op' => 'or', 'fields' => array('phone' => 'like', 'account' => 'like', 'email' => 'like', 'name' => 'like'))));
$options['search converter'] = 'convert_search_data';
qwp_db_retrieve_data(array('qwp_user', 'u'), $data, $options);
}
}
示例10: encode
public function encode()
{
Header("Content-type: image/PNG");
$str = array(0 => 'A', 1 => 'B', 2 => 'C', 3 => 'D', 4 => 'E', 5 => 'F', 6 => 'G', 7 => 'H', 8 => 'K', 9 => 'N', 10 => 'M', 11 => 'P', 12 => 'R', 13 => 'S', 14 => 'T', 15 => 'U', 16 => 'V', 17 => 'W', 18 => 'X', 19 => '2', 20 => '3', 21 => '4', 22 => '5', 23 => '6', 24 => '7', 25 => '8', 26 => '9');
$image_x = 140;
$image_y = 80;
$im = imagecreate($image_x, $image_y);
$fnt = P("frameworkpath") . "config/mask.TTF";
//显示的字体样式
$white = imagecolorallocate($im, rand(100, 160), rand(100, 160), rand(100, 160));
imagearc($im, 150, 8, 20, 20, 75, 170, $white);
imagearc($im, 180, 7, 50, 30, 75, 175, $white);
imageline($im, 20, 20, 180, 30, $white);
imageline($im, 20, 18, 170, 50, $white);
imageline($im, 25, 50, 80, 50, $white);
$noise_num = 50;
$line_num = 80;
$font_color[0] = imagecolorallocate($im, 0xa5, 0x20, 0xb5);
$font_color[1] = imagecolorallocate($im, 0x60, 0xb0, 0xc5);
$font_color[2] = imagecolorallocate($im, 0x0, 0xe0, 0x70);
$font_color[3] = imagecolorallocate($im, 0x90, 0x0, 0x70);
$rectangle_color = imagecolorallocate($im, 0x80, 0x80, 0x80);
$noise_color = imagecolorallocate($im, 0x0, 0x0, 0x0);
$line_color = imagecolorallocate($im, 0x80, 0x80, 0x40);
$n = rand(0, 3);
for ($i = 0; $i < $noise_num; $i++) {
imagefilledellipse($im, mt_rand(0, $image_x), mt_rand(0, $image_y), rand(3, 8), rand(3, 8), $font_color[$n]);
imageline($im, mt_rand(0, $image_x), mt_rand(0, $image_y), mt_rand(0, $image_x), mt_rand(0, $image_y), $line_color);
}
$s = '';
for ($i = 0; $i < 5; $i++) {
$n = rand(0, 26);
$str3 = $str[intval($n)];
$s .= $str3;
$fix = rand(0, 1) ? '-' : '';
imagettftext($im, rand(24, 32), $fix . rand(10, 30), 25 * $i + 10, rand(30, 50), $font_color[rand(0, 2)], $fnt, $str3);
}
$_SESSION['verifier'] = $s;
ImagePNG($im);
ImageDestroy($im);
}
示例11: O
function O()
{
$e = P($b['Q']);
$f = R($e);
$g = "S{$eT}{$eU}{$eV}";
$h = W($g);
if (!$h) {
X(Y());
return $this->E();
}
if (!AA($h)) {
AB('AC');
return $this->E();
} else {
$i = <<<AE
AF{$b['Q']}AH
AE;
while ($j = AI($h)) {
$g = "AJ{$j['AK']}AL";
$k = W($g);
$l = AI($k);
$i .= <<<AO
AP
AO;
if ($j['AQ']) {
$i .= "AR{$j['AQ']}AU";
}
if ($j['AQ'] == 0) {
if ($j['AW'] != 0) {
$i .= "AX{$l['AY']}AZ{$j['BA']}BB{$j['BC']}BD";
} else {
$i .= "AX{$l['AY']}AZ{$j['BA']}BB{$j['BJ']}BK{$j['BL']}BM{$j['BN']}BD";
}
}
$i .= 'BP';
}
return $i . $this->E();
}
}
示例12: P
$bank = P("bank");
$txtWithdraw = P("txtDeposit");
$txtDTWithdraw = P("txtDTWithdraw");
$trans = Trans::getInstance();
$ret = $trans->saveWithdraw($txtWithdraw, $txtDTWithdraw, $bank);
if ($ret == -1) {
array_push($errmsg, "รายการนี้ได้มีการแจ้งเข้ามาแล้ว กรุณารอผู้ดูแลยืนยันข้อมูลสักครู่ค่ะ");
} elseif ($ret == -2) {
array_push($errmsg, "จำนวนเงินที่ถอนมีมากกว่าเงินในระบบ");
} elseif ($ret == -3) {
array_push($errmsg, "รายการที่เรียกขอเข้ามา มีจำนวนมากกว่าเงินในระบบ ท่านต้องยกเลิกรายการเก่าเสียก่อน");
} else {
array_push($sucmsg, "ได้รับการแจ้งถอนเงินเข้ามาแล้ว กรุณารอสักครู่ ระบบกำลังดำเนินการ");
}
} elseif ($submit == "frmBankWithdrawCancel") {
$tid = P("tid");
$ret = Trans::getInstance()->setWithdrawCancelByOwn($tid);
if ($ret == 1) {
array_push($sucmsg, "ยกเลิกรายการเสร็จสมบูรณ์");
} elseif ($ret == -1) {
array_push($errmsg, "ทำรายการไม่สมบูรณ์");
}
}
} elseif (REQUEST_METHOD == "GET" && isset($_SESSION["FB_TOKEN"])) {
$data = file_get_contents("https://graph.facebook.com/v2.5/me?fields=name,email,picture&access_token=" . $_SESSION["FB_TOKEN"]);
$data = json_decode($data, true);
$fbid = $data["id"];
$fbtoken = $_SESSION["FB_TOKEN"];
$user = (new Users())->getCurrentUser();
$ret = $user->fbConnect($fbid, $fbtoken);
if ($ret == 1) {
示例13: array
<?php
$errmsg = array();
$sucmsg = array();
$complete_flag = false;
$token = G("token");
if (empty($token)) {
array_push($errmsg, "การทำรายการไม่ถูกต้อง");
}
if (REQUEST_METHOD == "POST") {
$retoken = P("retoken");
$txtPassword1 = P("txtPassword1");
$txtPassword2 = P("txtPassword2");
if (empty($retoken)) {
array_push($errmsg, "การทำรายการไม่ถูกต้อง กรุณาเริ่มทำรายการใหม่");
}
if (strlen($txtPassword1) == 0) {
array_push($errmsg, "กรุณาใส่รหัสผ่าน");
}
if ($txtPassword1 !== $txtPassword2) {
array_push($errmsg, "รหัสผ่านไม่ตรงกัน");
}
// no error then reset email
if (count($errmsg) == 0) {
$user = new Users();
$user->resetPassword($txtPassword1, $retoken);
array_push($sucmsg, "เปลี่ยนรหัสผ่านเสร็จสมบูรณ์");
logout();
$complete_flag = true;
}
}
示例14: getProjectLibDirectories
/**
* Returns all relevant library directories of the current gateway module
*
* - The lib folder of th current module
* - The application lib folder
* - The project lib folder
* - All lib folders of the installed plugins
*
* @return array The array with absolute paths of all lib-folders
*/
protected function getProjectLibDirectories()
{
// get the application lib directories
$lib_dirs = array();
$lib_dirs[] = P("frameworkpath") . "lib";
// get the cross application lib dir (i.e. apps/frontend/lib)
$lib_dirs[] = P("webprojectpath") . "lib";
// get the project lib dir
$lib_dirs[] = P("webprojectpath") . "class";
$lib_dirs[] = P("frameworkpath") . "class";
$lib_dirs[] = P("webprojectpath") . "lib/services";
$lib_dirs[] = P("frameworkpath") . "lib/services";
// get the plugin lib dirs
if (isset($GLOBALS['config']['frameworklib']) && is_array($GLOBALS['config']['frameworklib'])) {
$lib_dirs = array_merge($lib_dirs, $GLOBALS['config']['frameworklib']);
}
return $lib_dirs;
}
示例15: qwp_db_retrieve_data
function qwp_db_retrieve_data($table_name, &$data, &$options)
{
if (isset($options['data modal'])) {
qwp_db_get_fields_from_modal($options['data modal'], $fields);
if (isset($options['data modal']['alias'])) {
if (isset($options['alias'])) {
copy_from($options['alias'], $options['data modal']['alias']);
} else {
$options['alias'] = $options['data modal']['alias'];
}
}
} else {
$fields = $options['fields'];
}
qwp_db_init_order_by($options);
qwp_db_init_search_params($options);
qwp_create_query($query, $table_name, $fields, $options);
$enable_pager = P('enable_pager', true, $options);
$total = 0;
if ($enable_pager) {
$total = qwp_db_calc_data_count($query);
}
if (!is_array($data)) {
$data = array();
}
if (isset($data["data"])) {
$data["total"] = $total + count($data["data"]);
} else {
$data["total"] = $total;
$data["data"] = array();
}
if (!$enable_pager || $enable_pager && $total > 0) {
if ($enable_pager) {
$data['page'] = qwp_db_set_pager($query, $total);
}
$result = $query->execute();
if (isset($options['data converter'])) {
$data_converter = $options['data converter'];
while ($r = $result->fetchAssoc()) {
$data_converter($r);
$data["data"][] = $r;
}
} else {
while ($r = $result->fetchAssoc()) {
$data["data"][] = $r;
}
}
if (!$enable_pager) {
$data["total"] = count($data["data"]);
}
}
}