本文整理汇总了PHP中Test::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Test::get方法的具体用法?PHP Test::get怎么用?PHP Test::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Test
的用法示例。
在下文中一共展示了Test::get方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public function save()
{
if (UserSession::getInstance()->getAccessLevel() < 3) {
die("<h1>Forbidden resource for you.</h1>");
}
$model = new Test();
$model->setFields($this->params);
$modelId = $model->get("tst_id");
if (!isset($modelId)) {
$status = $this->saveNew($model);
return $status;
} else {
$status = $this->update($model);
return $status;
}
}
示例2: get
function get();
}
class Test implements Demo, Demo1
{
function show()
{
echo "------" . "<br>";
}
function get()
{
echo "++++++" . "<br>";
}
}
$num = new Test();
$num->show();
$num->get();
interface USB
{
function start();
function stop();
function work();
}
class Blue implements USB
{
function start()
{
echo "Blue starting...." . "<br>";
}
function stop()
{
echo "Bule stop..." . "<br>";
示例3: Test
{
global $array;
return $array;
}
}
$obj = new Test();
$objName = 'obj';
$get = 'get';
$get_static = 'get_static';
$Test = 'Test';
testStrict(get()[0], 'hi', 'func()[]');
testStrict(Test::get_static()[0], 'hi', 'Class::method()[]');
testStrict($Test::$get_static()[0], 'hi', '$class::$method()[] (depends on varClassStatic)');
testStrict($get()[1], 7, '$func()[]');
testStrict(${$get}()[1], 7, '$$func()[]');
testStrict($obj->get()[1], 7, '$obj->method()[]');
testStrict(${$objName}->{${$get}}()[1], 7, '$$obj->$$method()[]');
class Very
{
public static function long()
{
return new self();
}
public function call()
{
global $array;
return $array;
}
}
testStrict(Very::long()->call()[0], 'hi', 'complex resolution');
?>
示例4: clone_task
public function clone_task($task_id)
{
$result = new stdClass();
$result->result = FALSE;
$this->_transaction_isolation();
$this->db->trans_begin();
$old_task = new Task();
$old_task->get_by_id((int) $task_id);
if ($old_task->exists()) {
$new_task = $old_task->get_copy();
if ($new_task->save()) {
$this->lang->clone_overlays('tasks', $old_task->id, $new_task->id);
$from = 'private/uploads/task_files/task_' . $old_task->id;
$continue = TRUE;
if (file_exists($from)) {
$to = 'private/uploads/task_files/task_' . $new_task->id;
if (!clone_directory($from, $to)) {
unlink_recursive($to, TRUE);
$this->db->trans_rollback();
$result->message = $this->lang->line('admin_tasks_error_message_files_not_cloned');
$continue = FALSE;
}
}
if ($continue) {
$old_categories = new Category();
$old_categories->where_related($old_task);
$old_categories->get();
if ($old_categories->result_count()) {
foreach ($old_categories->all as $old_category) {
$old_category->save($new_task);
}
}
$old_tests = new Test();
$old_tests->where_related($old_task);
$old_tests->get();
if ($old_tests->result_count()) {
foreach ($old_tests->all as $old_test) {
$new_test = $old_test->get_copy();
if ($new_test->save($new_task)) {
$this->lang->clone_overlays('tests', $old_test->id, $new_test->id);
$from = 'private/uploads/unit_tests/test_' . $old_test->id;
$to = 'private/uploads/unit_tests/test_' . $new_test->id;
clone_directory($from, $to);
}
}
}
$this->db->trans_commit();
$result->result = TRUE;
$result->message = $this->lang->line('admin_tasks_success_message_task_cloned');
}
} else {
$this->db->trans_rollback();
$result->message = $this->lang->line('admin_tasks_error_message_clone_dont_saved');
}
} else {
$this->db->trans_rollback();
$result->message = $this->lang->line('admin_tasks_error_message_task_not_found');
}
$this->output->set_content_type('application/json');
$this->output->set_output(json_encode($result));
}
示例5: intval
<?php
require_once 'lib/common.inc.php';
require_once 'lib/carriers.inc.php';
$test_id = intval($_GET['test_id']);
if ($test_id == 0) {
die("invalid test_id");
}
$carrier_id = intval($_GET['carrier_id']);
if ($carrier_id == 0) {
die("invalid carrier_id");
}
$test = Test::get("WHERE `id` = %d", $test_id);
if (!$test) {
exit;
}
if (!isset($_SESSION['tests']) || !isset($_SESSION['tests'][$test_id])) {
exit;
}
$RES =& $_SESSION['tests'][$test_id];
if (!$test->sms_enabled || empty($RES->sms_resp)) {
// redirect("test.php?test_id=$test->id");
die;
}
$best_carrier = null;
foreach ($js_carriers as $carrier) {
if (intval($carrier->id) == $carrier_id) {
$best_carrier = $carrier;
}
}
if (is_null($best_carrier)) {
示例6: __get
<?php
class Test
{
protected $val = ['one' => 'This is One', 'two' => 'This is Two', 'three' => 'This is Three'];
/*public $one = 'This is One';
public $two = 'This is Two';
public $three = 'This is Three';*/
public function __get($method)
{
return isset($this->val[$method]) ? $this->val[$method] : null;
}
}
$methods = ['one', 'two', 'three'];
$test = new Test();
foreach ($methods as $method) {
//echo call_user_func([$test, $method]).'<br />';
echo $test->get($method) . '<br />';
}
示例7: lists
function lists()
{
if ($this->_user) {
$t = $this->_user->test->get();
} else {
$t = new Test();
$t->get();
}
//datamapper的json扩展真是强大
echo $t->all_to_json();
}
示例8: put
{
public function put($p)
{
$ret['s'] = 'OK';
$t = new CassandraCF('mall', 'UserItem', true);
// if(is_array($p)){
$id = $p['u'];
$ret['id'] = $t->put_super($p['d'], $id);
return $ret;
}
public function get($p)
{
$ret['s'] = 'OK';
$t = new CassandraCF('mall', 'UserItem', true);
$id = $p['u'];
$ret['d'] = $t->get($id);
return $ret;
}
}
//return;
$p = array('u' => '2', 'd' => array('id' => 'testid', 'first' => 'Zeng', 'last' => 'tingkun', 'addr' => array('city' => 'beijing', 'zip' => '123456')));
print_r($p);
$t = new Test();
record_time($start);
print_r($t->put($p));
record_time($start, '$t->put($p)');
$p['d']['id'] = '';
$p['d']['info'] = 'with no id';
print_r($t->put($p));
print_r($t->get($p));
record_time($start, '$t->get($p)');
示例9: delete
/**
* Deletes relations (if parameters are set) or this object from database.
* @param DataMapper|string $object related object to delete from relation.
* @param string $related_field relation internal name.
*/
public function delete($object = '', $related_field = '')
{
$this_id = $this->id;
parent::delete($object, $related_field);
if (empty($object) && !is_array($object) && !empty($this_id)) {
$tests = new Test();
$tests->where_related($this);
$tests->get();
if ($tests->result_count()) {
foreach ($tests->all as $test) {
$test->delete();
}
}
$path = 'private/uploads/task_files/task_' . intval($this_id) . '/';
if (file_exists($path)) {
unlink_recursive($path, TRUE);
}
}
}
示例10:
<?php
include '../lib/common.inc.php';
$test_id = $_REQUEST['test_id'];
if (!Test::get("SELECT id FROM tests WHERE id=?", $test_id)) {
error_redirect('', 'Такого теста больше нет');
}
foreach ($_REQUEST['question_order'] as $qid => $order) {
dbkit_execute("UPDATE questions SET `order`=? WHERE test_id=? AND id=?", $order, $test_id, $qid);
}
示例11: indexAction
public function indexAction()
{
return Test::get();
}