当前位置: 首页>>代码示例>>PHP>>正文


PHP k函数代码示例

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


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

示例1: spl_autoload_register

require_once 'VIH/configuration.php';
require_once 'konstrukt/konstrukt.inc.php';
require_once 'bucket.inc.php';
require_once 'Ilib/ClassLoader.php';
require_once 'Doctrine.php';
spl_autoload_register(array('Doctrine', 'autoload'));
class VIH_NotFoundComponent extends k_Component
{
    protected $template;
    function __construct(k_TemplateFactory $template)
    {
        $this->template = $template;
    }
    function dispatch()
    {
        $tpl = $this->template->create('404');
        $response = new k_HtmlResponse($tpl->render($this));
        $response->setStatus(404);
        return $response;
    }
}
class VIH_Document extends k_Document
{
}
$factory = new VIH_Factory();
$container = new bucket_Container($factory);
if (realpath($_SERVER['SCRIPT_FILENAME']) == __FILE__) {
    $components = new k_InjectorAdapter($container, new VIH_Document());
    $components->setImplementation('k_DefaultPageNotFoundComponent', 'VIH_NotFoundComponent');
    k()->setComponentCreator($components)->run('VIH_Controller_Login_Root')->out();
}
开发者ID:vih,项目名称:vih.dk,代码行数:31,代码来源:index.php

示例2: empty

      </div>
      <span id='copyright'>
        <?php 
$copyright = empty($config->site->copyright) ? '' : $config->site->copyright . '-';
$contact = json_decode($config->company->contact);
$company = (empty($contact->site) or $contact->site == $this->server->http_host) ? $config->company->name : html::a('http://' . $contact->site, $config->company->name, "target='_blank'");
echo "&copy; {$copyright}" . date('Y') . ' ' . $company . '&nbsp;&nbsp;';
?>
      </span>
      <span id='icpInfo'><?php 
echo $config->site->icpSN;
?>
</span>
      <div id='powerby'>
        <?php 
printf($lang->poweredBy, $config->version, k(), $config->version);
?>
      </div>
    </div>
  </footer>
   
<?php 
if ($config->debug) {
    js::import($jsRoot . 'jquery/form/min.js');
}
if (isset($pageJS)) {
    js::execute($pageJS);
}
/* Load hook files for current page. */
$extPath = dirname(dirname(dirname(__FILE__))) . '/common/ext/view/';
$extHookRule = $extPath . 'footer.front.*.hook.php';
开发者ID:wenyinos,项目名称:chanzhieps,代码行数:31,代码来源:footer.html.php

示例3: setaccess

 function setaccess()
 {
     $rid = $_GET['rid'];
     $db = k("role");
     $role = $db->find($rid);
     $this->assign('role', $role);
     $node = Rbac::getNodeList($rid);
     if (!$node) {
         $this->error("还没有设置权限节点,请设置", 'showaddnode');
     }
     $this->assign('node', $node);
     $this->display();
 }
开发者ID:jyht,项目名称:v5,代码行数:13,代码来源:RbacControl.class.php

示例4: k

include_once "./vendor/autoload.php";
?>
<!doctype html>
<html lang="it">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <title></title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">

    </head>
    <body>
	<?php 
if (isset($_GET)) {
    echo '<h2>$_GET</h2>';
    k($_GET);
}
if (isset($_POST)) {
    echo '<h2>$_POST</h2>';
    k($_POST);
}
if (isset($_REQUEST)) {
    echo '<h2>$_REQUEST</h2>';
    k($_REQUEST);
}
?>
    </body>
</html>
开发者ID:nervaccio,项目名称:debug-target-post,代码行数:29,代码来源:index.php

示例5: implode

        if ($tags) {
            if ($user->send_category_as_array != 1) {
                $data['category'] = $tags;
            } else {
                $data['category'] = implode(',', $tags);
            }
        }
    }
    // Handle attachments
    $filename = false;
    foreach ($_FILES as $file) {
        // If a photo was included, set the filename to the downloaded file
        if (preg_match('/image/', $file['type'])) {
            $filename = $file['tmp_name'];
        }
        // Sometimes MMSs are sent with a txt file attached instead of in the body
        if (preg_match('/text\\/plain/', $file['type'])) {
            $content = trim(file_get_contents($file['tmp_name']));
            if ($content) {
                $data['content'] = $content;
            }
        }
    }
    $r = micropub_post_for_user($user, $data, $filename);
    if (k($r, 'location')) {
        $result = 'created post at ' . $r['location'];
    } else {
        $result = 'error creating post';
    }
    $app->response()->body($result);
});
开发者ID:voxpelli,项目名称:Quill,代码行数:31,代码来源:hooks.php

示例6: nl2br

            break;
        default:
            print "<td></td></tr>";
            break;
    }
}
?>
  </table>
</TD></TR>

<TR style="background-color=#f5f5f5"><TD>
  <TABLE BORDER=0 CELLSPACING=2 CELLPADDING=0>
  <tr><td><b>Full text of the complaint</b> &nbsp; (<A HREF="JavaScript:window.print();">click here to print</A>)</td></tr>
  <tr><td>&nbsp;</td></tr>
  <tr><td><?php 
print nl2br(k($c->message));
?>
</td></tr>
  <tr><td>&nbsp;</td></tr>

  <?php 
if ($c->confirmed == "N") {
    ?>
     <tr><td align=center><FORM ACTION="complaint.php?c=<?php 
    print $c->id;
    ?>
&" METHOD=post><input type=submit value="Confirm Receipt"><input name=confirm type=hidden></form></td></tr>
  <?php 
} else {
    ?>
     <tr><td align=center><input type=button value="Back" onClick="JavaScript:location='members.php';"></td></tr>
开发者ID:RobertBohn,项目名称:TellSafe-II,代码行数:31,代码来源:complaint.php

示例7: var_dump

// PHP5 64  allowed with warning "PHP Strict standards:  Only variables
//     should be passed by reference", but does not change the original argument
// HHVM, allowed quietly, but does not change the original argument
var_dump($z);
g($z = $z - 2);
// same as above
var_dump($z);
// g($z++);			// PHP5 32/64, Error: Only variables can be passed by reference
// HHVM,       Error: Cannot pass parameter 1 by reference
// ($z++)++;		// All 3, Error: unexpected '++'
g(--$z);
// PHP5 32, allowed quietly, but does not change the original argument
// PHP5 64  allowed with warning "PHP Strict standards:  Only variables
//     should be passed by reference", but does not change the original argument
// HHVM, allowed quietly, but does not change the original argument
// ----$z;			// All 3, Error: unexpected '--'
var_dump($z);
//*/
///*
function k()
{
    return 10;
}
var_dump(k());
g(k());
// PHP5 32, allowed quietly, but (presumably) does not change the original argument
// PHP5 64  allowed with warning "PHP Strict standards:  Only variables
//     should be passed by reference", but (presumably) does not change the original argument
// k() = 10;   // All 3, Error: Can't use function return value in write context
// HHVM, allowed quietly, but (presumably) does not change the original argument
//*/
开发者ID:mfsousa,项目名称:php-langspec,代码行数:31,代码来源:passing_arguments.php

示例8: upload_file

function upload_file($type = 'img', $dir = '/media/')
{
    global $app;
    if ($type == "img") {
        $file_form = $_FILES['img-file'];
    } else {
        if ($type == "doc") {
            $file_form = $_FILES['doc-file'];
        }
    }
    $maxSize = 25000000;
    $imgExts = array("gif", "jpeg", "jpg", "png");
    $docExts = array("pdf", "doc", "docx", "xls", "xlsx", "csv");
    $allowedExts = array_merge($imgExts, $docExts);
    $allowedTypes = array("image/gif", "image/jpeg", "image/jpg", "image/pjpeg", "image/x-png", "image/png", "application/pdf", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "application/vnd.ms-excel", "application/msword");
    $file_obj = array();
    $file_obj['name'] = str_replace(" ", "_", $file_form['name']);
    $temp = explode(".", $file_obj['name']);
    $file_obj['ext'] = strtolower(end($temp));
    $file_obj['prefix'] = implode("", array_slice($temp, 0, -1));
    $file_obj['error'] = $file_form["error"];
    $file_obj['app_type'] = $file_form["type"];
    $file_obj['size'] = $file_form["size"];
    $file_obj['tmp_name'] = $file_form["tmp_name"];
    // Check for errors
    // File exists
    if (empty($file_form) or empty($file_obj['name'])) {
        $app['_error'] .= "Missing file or filename.<br>";
        return false;
    }
    // Allowed extension
    if (!in_array($file_obj['ext'], $allowedExts)) {
        k($allowedExts);
        $app['_error'] .= "<strong>" . $file_obj['ext'] . "</strong> is not an allowed extension.<br>";
        return false;
    } else {
        // Get file type from extension
        if (in_array($file_obj['ext'], $imgExts)) {
            $file_obj['type'] = "file-image";
        } else {
            $file_obj['type'] = "file-document";
        }
    }
    // Allowed type
    if (!in_array($file_obj['app_type'], $allowedTypes)) {
        $app['_error'] .= "<strong>" . $file_obj['app_type'] . "</strong> is not an allowed file type.<br>";
        return false;
    }
    // Size limit
    if ($file_obj['size'] > $maxSize) {
        $megs = number_format($file_obj['size'] / 1000000, 2);
        $allowedMegs = number_format($maxSize / 1000000, 2);
        $app['_error'] .= "<strong>{$megs} MB</strong> is too large. The maximum size allowed is {$allowedMegs} MB.<br>";
        return false;
    }
    // Other file upload errors
    if ($file_obj['error'] > 0) {
        $app['_error'] .= "Upload file error: " . $file_obj['error'] . "<br>";
        return false;
    }
    if ($app['_error'] === "") {
        $file_obj['path'] = $app['_root_url'] . $dir . $file_obj['name'];
        $file_obj['root_path'] = $app['_web_root'] . $dir . $file_obj['name'];
        if (file_exists($app['_web_root'] . $dir . $file_obj['name'])) {
            $app['_warning'] .= "<strong>Warning: </strong>" . $file_obj['name'] . " already exists. Updating file. <br>";
        }
        if (move_uploaded_file($file_obj['tmp_name'], $file_obj['root_path'])) {
            $app['_success'] .= "Uploaded file to <strong><a href='" . $file_obj['path'] . "' target='_blank'>" . $file_obj['path'] . "</a></strong>.<br>";
        } else {
            $app['_error'] .= "Error moving uploaded file to requested directory. <br>";
        }
        return $file_obj;
    } else {
        return false;
    }
}
开发者ID:jasonnug,项目名称:simple-web-framework,代码行数:76,代码来源:include.php

示例9: fopen

<?php

include "../../class.krumo.php";
$fp = fopen(__FILE__, "r");
$a = array('first' => $fp, 'last' => new bar(), 'null_var' => null, 'float' => pi(), 'bool' => true, ' leading_space' => 6 * 8, 'trailing_space ' => 'grapes', 'middle space' => 'Mt. Rushmore', 'phones' => array(5036541278, 8714077831, 'x253'), 'long_str' => "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum...", 'empty_arr' => array(), 'func_str' => 'preg_replace', 'address' => array('street' => '123 Fake Street', 'city' => 'Portland', 'state' => 'Maine'), 'unixtime' => 1231241234, 'microtime' => microtime(1));
if (isset($_GET['short']) || php_sapi_name() === 'cli') {
    kd($a, KRUMO_EXPAND_ALL);
}
print "<h2>krumo capture</h2>\n";
$str = k(array('foo' => 'bar'), KRUMO_RETURN);
print $str;
print "<h2>krumo</h2>\n";
k(array('likes', 'kittens', 'and', 'dogs'));
print "<h2>krumo passing multiple args</h2>\n";
k('likes', 'kittens', 'and', 'dogs');
print "<h2>krumo + die()</h2>\n";
kd($a);
print "If you see this something is broken";
$k = new krumo();
class bar
{
    public $b = 'bb';
    public $a = 'aa';
    public function foo()
    {
        return 'bar';
    }
}
开发者ID:mmucklo,项目名称:krumo,代码行数:28,代码来源:misc.php

示例10: ob_start

<?php

ob_start();
$ss_timer = microtime(true);
require_once '../../conf/global.conf.php';
//create_container();
k()->setComponentCreator(new \Slipstream\Common\Injector\BucketAdapter($i = create_container()))->setLog($debug_log_path)->setDebug($debug_enabled)->run('Slipstream\\JsonRest\\Component\\Root')->out();
//$i->get('Slipstream\Common\Log\Handler')->log($i->get('Slipstream\Common\ConfigurationInterface'),'Execution time');
$i->get('Slipstream\\Common\\Log\\Handler')->log(microtime(true) - $ss_timer, 'Execution time');
ob_end_flush();
开发者ID:jaanush,项目名称:slipstream,代码行数:10,代码来源:index.php

示例11: k

        $response = ['latitude' => null, 'longitude' => null, 'locality' => null, 'region' => null, 'country' => null, 'best_name' => null, 'full_name' => null, 'timezone' => null, 'offset' => null, 'seconds' => null, 'localtime' => null];
        if (k($params, 'input')) {
            $adr = p3k\Geocoder::geocode($params['input']);
        } else {
            $lat = (double) $params['latitude'];
            $lng = (double) $params['longitude'];
            $response['latitude'] = $lat;
            $response['longitude'] = $lng;
            $adr = p3k\Geocoder::adrFromLocation($lat, $lng);
        }
        if ($adr) {
            $response['latitude'] = $adr->latitude;
            $response['longitude'] = $adr->longitude;
            $response['locality'] = $adr->localityName;
            $response['region'] = $adr->regionName;
            $response['country'] = $adr->countryName;
            $response['best_name'] = $adr->bestName;
            $response['full_name'] = $adr->fullName;
        }
        $timezone = p3k\Timezone::timezone_for_location($response['latitude'], $response['longitude'], k($params, 'date'));
        if ($timezone) {
            $response['timezone'] = $timezone->name;
            $response['offset'] = $timezone->offset;
            $response['seconds'] = $timezone->seconds;
            $response['localtime'] = $timezone->localtime;
        }
        json_response($app, $response);
    } else {
        json_response($app, ['error' => 'invalid_request', 'error_description' => 'Request was missing parameters'], 400);
    }
});
开发者ID:aaronpk,项目名称:Atlas,代码行数:31,代码来源:geocode.php

示例12: array

            $username->addValidator('regex', false, array('/^[a-z]+/'));
            $username->addValidator('stringLength', false, array(6, 20));
            $username->setRequired(true);
            $username->addFilter('StringToLower');
            // Create and configure password element:
            $password = $form->createElement('password', 'password');
            $password->setLabel("Password");
            $password->addValidator('StringLength', false, array(6));
            $password->setRequired(true);
            // Add elements to form:
            $form->addElement($username);
            $form->addElement($password);
            // use addElement() as a factory to create 'Login' button:
            $form->addElement('submit', 'login', array('label' => 'Login'));
            // Since we're using this outside ZF, we need to supply a default view:
            $form->setView(new Zend_View());
            $this->form = $form;
        }
        return $this->form;
    }
}
class ZfThanks extends k_Component
{
    function renderHtml()
    {
        return sprintf("<p>%s</p>", htmlspecialchars($this->query('flare')));
    }
}
if (realpath($_SERVER['SCRIPT_FILENAME']) == __FILE__) {
    k()->run('ZfRegistrationForm')->out();
}
开发者ID:RussellDias,项目名称:konstrukt,代码行数:31,代码来源:index.php

示例13:

          <p>The token endpoint did not return an access token. The <code>access_token</code> parameter is the token the client will use to make requests to the Micropub endpoint.</p>
        <?php 
                }
                ?>

        <?php 
                if (!k($this->auth, 'me')) {
                    ?>
          <h4>Missing <code>me</code></h4>
          <p>The token endpoint did not return a "me" parameter. The <code>me</code> parameter lets this client know what user the token is for.</p>
        <?php 
                }
                ?>

        <?php 
                if (!k($this->auth, 'scope')) {
                    ?>
          <h4>Missing <code>scope</code></h4>
          <p>The token endpoint did not return a "scope" parameter. The <code>scope</code> parameter lets this client what permission the token represents.</p>
        <?php 
                }
                ?>

      <?php 
            }
            ?>

    <?php 
        }
        ?>
  <?php 
开发者ID:voxpelli,项目名称:OwnYourGram,代码行数:31,代码来源:auth_callback.php

示例14: dirname

<?php

require_once dirname(__FILE__) . '/../config/global.inc.php';
k()->setComponentCreator(new k_InjectorAdapter(create_container()))->setLog($debug_log_path)->setDebug($debug_enabled)->run('components_Root')->out();
开发者ID:harrysame,项目名称:PHP-MySQL,代码行数:4,代码来源:index.php

示例15: var_dump

{
    echo '$p ' . (isset($p) ? "is set\n" : "is not set\n");
    var_dump($p);
    return $p;
    // return undefined variable
}
$a = array(10, 20, 30);
var_dump($a);
$d =& k($a[0]);
var_dump($d);
var_dump($a);
$d =& k($a[5]);
// non-existant element going in
var_dump($d);
var_dump($a);
$d =& k($a["red"]);
// non-existant element going in
var_dump($d);
var_dump($a);
//*/
///*
// returning literals byRef is okay
function &m1()
{
    return NULL;
}
$d =& m1();
var_dump($d);
function &m2()
{
    return 1234;
开发者ID:jeremyadoux,项目名称:hhvm,代码行数:31,代码来源:using_byrefs_to_undefined_variables.php


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