$(document).ready(function () {
var modal;
if (window.location.hash && (modal = $(window.location.hash)) && modal.length) {
// тут код, который отобразит модальное окно
}
});
$str = '{tabs = некоторый код}тут текст
в несколько строк{/tabs}';
echo preg_match('/\{tabs[^\}]+\}([^\{]+)\{\/tabs\}/', $str, $matched) ?
print_r($matched, true) : 'false';
Array
(
[0] => {tabs = некоторый код}тут текст
в несколько строк{/tabs}
[1] => тут текст
в несколько строк
)
.clicked {
background-color: red;
}
$('.myclass').on('click', function () {
$(this).toggleClass('clicked');
});
INSERT INTO `billings` (user_id, billing_type, currency_id)
SELECT
b.user_id
,b.billing_type
,c.id as currency_id
FROM (
SELECT 11 as user_id, 1 as billing_type UNION
SELECT 11 as user_id, 2 as billing_type UNION
SELECT 11 as user_id, 3 as billing_type
) b
INNER JOIN `currency` c ON c.name='usd'
if (preg_match('/' . preg_quote($_SERVER['PHP_SELF'], '/') . '$/i', str_replace('\\', '/', __FILE__))) {
exit();
}
return [
'router' => [
'routers' => [
'api-login' => [ // REST
'type' => 'Literal',
'options' => [
'route' => '/api/login',
'defaults' => [
'controller' => 'YourModule\Controller\Login'
],
],
],
'login' => [
'type' => 'Literal',
'options' => [
'route' => '/login',
'defaults' => [
'controller' => 'YourModule\Controller\Login'
'action' => 'login',
],
],
],
],
],
'view_manager' => [
'strategies' => [
'ViewJsonStrategy',
],
],
'controllers' => [
'invokables' => [
'YourModule\Controller\Login' => 'YourModule\Controller\LoginController',
],
],
];
class LoginController extends AbstractRestfulController {
public function create($data) {
// POST данные пришедшие по REST
return new JsonModel(['status' => 'error', 'message' => 'Логин и/или пароль указан не верно.']);
}
public function getList() {
// GET данные без id
return new JsonModel(['item1', 'item2', 'item3']);
}
public function loginAction() {
// обычный Action
return new ViewModel();
}
}