JSfiddle的界面已经改变,我看不到任何添加选项jQuery
,并将其设置onLoad
为之前的..
那么有人可以帮助我如何激活它.
谢谢你的帮助.
您好我在CakePHP 3项目上工作..
我想从default.ctp显示已登录用户的用户名,所以我试过这个:
//in default.ctp
$user = $this->Session->read('Auth.User');
if(!empty($user)) {
echo 'Hi ', $user['user_name'];
}
Run Code Online (Sandbox Code Playgroud)
它不起作用,我发现其他解决方案告诉将当前用户从AppController放入会话中它也不起作用这是它:
// in AppController
function beforeFilter(){
$user = $this->Session->read('Auth.User');
$this->set('username', $user['username']);
}
Run Code Online (Sandbox Code Playgroud)
并在default.ctp中:
<?=$username?>
Run Code Online (Sandbox Code Playgroud)
有人能帮我吗 ?
我使用一些过滤器在记录中创建了一个视图,并且我必须添加仅包含来自另一个表的ID和sql结果末尾的特定行的行。
因此,预期结果是这样的:
Column 1 | Column 2 | Column 3 | Column4
1 0001 | 565 | AM1 | DR01
.
.
59 TEST1 | | |
60 NON_IMMO | | |
Run Code Online (Sandbox Code Playgroud)
第59行是第二个表的ID,第60行是指定行。我的查询是这样的:
SELECT DISTINCT a.asset_id
, a.serial_id
, a.VIN
, b.project_id
FROM ps_asset a
WHERE --Some conditions
UNION
SELECT PO_GROUP_ID
,' '
, ' '
, ' '
FROM PS_PO_GROUP_TBL
UNION
SELECT 'NON_IMMO'
,' '
,' '
,' '
FROM dual
Run Code Online (Sandbox Code Playgroud)
但是问题是使用这个,我没有得到最后的特定行。
我觉得SGBD会显示按字母顺序排列的2个UNIONS。
Column 1 | Column 2 | …
Run Code Online (Sandbox Code Playgroud) 如何在Cakephp3中为paginate添加条件..
这是我的代码:
$this->paginate = [
'contain' => ['Users']
];
$proprietes = $this->paginate($this->Proprietes);
$this->set(compact('proprietes'));
$this->set('_serialize', ['proprietes']);
Run Code Online (Sandbox Code Playgroud)
例如,像这样的东西:
$this->paginate($this->Proprietes)->where(['status'=>'pending']);
谢谢你的帮助.
我在CakePHP 3.2项目上工作。
我有一个Property
实体。
当用户创建属性时,管理员必须验证该属性是否处于活动状态。.之后,我在字段中输入date_of_expiration
了当前日期+ 10天,例如...
我想的是,这个属性在此日期(当前日期+ 10天)就过期了通过改变一个名为场status
从活跃到不活跃 ..
我在Google上搜索后发现,我需要称之为Sheduled Task ..
我问在CakePHP 3.2中执行此操作的最佳方法
我想找到我的数据库中有两个列的所有表LOCATION
和ASSET_ID
所以我尝试了这个:
select owner, table_name, column_name
from all_tab_columns
where column_name in ('LOCATION','ASSET_ID');
Run Code Online (Sandbox Code Playgroud)
问题是这个查询给出了所有具有LOCATION
或ASSET_ID
不具有这两个表的表.
所以我改成了这个:
select owner, table_name, column_name
from all_tab_columns
where 1=1
and column_name ='LOCATION'
and column_name = 'ASSET_ID';
Run Code Online (Sandbox Code Playgroud)
它显示0结果.
请帮忙.
我想在db中的日期和当前日期之间得到区别
那是我的代码:
$current_date = new \DateTime(date('Y-m-d H:i:s'));
foreach ($notifs as $notif) {
$created_notif = new \DateTime($notif->created);
$diff = date_diff($current_date, $created_notif);
if ($diff->y > 0) {
$notif->time = $diff->y . " year";
}
//..
}
Run Code Online (Sandbox Code Playgroud)
这是我得到的错误:
DateTime :: __ construct():无法在位置0(1)处解析时间字符串(17/05/2016 08:54):
并且不要说我没有搜索过我 DateTime::createFromFormat
有点像这样:
$format = 'Y-m-d H:i:s';
$current_date = new \DateTime(date($format));
foreach ($notifs as $notif) {
$created_notif =\DateTime::createFromFormat($format,$notif->created);
$diff = date_diff($current_date, $created_notif);//line 32
debug($created_notif);//line 33
die();
Run Code Online (Sandbox Code Playgroud)
这就是我得到的:
警告(2):date_diff()期望参数2为DateTimeInterface,给定布尔值为[APP/Controller\AdminController.php,第32行]
\ src\Controller\AdminController.php(第33行)
假
拜托我需要你的帮忙