本文整理汇总了PHP中S::get方法的典型用法代码示例。如果您正苦于以下问题:PHP S::get方法的具体用法?PHP S::get怎么用?PHP S::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类S
的用法示例。
在下文中一共展示了S::get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testAssertElementHasNotText
public function testAssertElementHasNotText()
{
S::get("/");
$this->assertElementHasNotText("h1", "asdasdasdasd");
}
示例2: testFormSubmit
public function testFormSubmit()
{
S::get("/");
S::click(".form-submit");
$this->assertBodyHasText("You have arrived");
}
示例3: S
$this->_data['data'] = $value;
}
}
// Initialize S class
$app = new S();
$app->_initData();
// Assigned database connection
// created at step #3
$app->conn = $database;
/* STEP 5: SET CONTENT TYPE AS JSON */
header("Content-Type: application/json; charset=utf-8");
/* STEP 7: Allow access to API */
header("Access-Control-Allow-Origin: *");
$app->get('/test-json', function () use($app) {
$variable = [1, 2, 3, 4, 4, 5, $app];
// STEP: 6 Use json_encode() output as JSON format
echo json_encode($variable);
});
$app->get('/user/:name', function ($name) use($app) {
// $user = $app->conn->GetRow('select * from users where id = ?',[$id]);
// $app->output($user);
$sql = 'select * from users where name like ';
$user = $app->conn->GetAll($sql, ['%' . $name . '%']);
if ($user) {
$app->message(count($user) . ' record(s) found.');
$app->data($user);
} else {
$app->message('No record found', true);
}
$app->output();
# Updating tables
示例4: S
<?php
require 'Slim/Slim.php';
require 'app/libs/S.php';
\Slim\Slim::registerAutoloader();
$app = new S();
$app->hook('slim.before', function () use($app) {
$app->response->header("Content-Type", "application/json; charset=utf-8");
});
$app->hook('slim.after', function () use($app) {
$app->output();
});
$app->get('/', function () use($app) {
$app->contents['messages'] = 'Welcome to S Web Services. Please provide application token to use the API.';
});
$app->run();