我正面临一个问题.我已经编写了分页代码.一切都按预期工作,但只有条件不起作用(只有特定条件)这是我的分页代码.
//declaration
public $paginate = array(
'limit' => 50,
'paramType' => 'querystring'
);
//use in action
$this->paginate['ApiLog'] = array('limit' => 50, 'order' => 'ApiLog.id DESC', 'paramType' => 'querystring');
$this->paginate['ApiLog']['conditions'] = array('ApiLog.log_type' => 2);
$this->paginate['ApiLog']['joins'] = array(
array(
'table' => 'users',
'alias' => 'User',
'type' => 'LEFT',
'conditions' => array('User.id = ApiLog.user_id')
)
);
$this->Paginator->settings = $this->paginate['ApiLog'];
$apilogs = $this->Paginator->paginate('ApiLog');
Run Code Online (Sandbox Code Playgroud)
此代码在开发环境中工作并且返回类型为2的日志,但在生产中它只返回类型为1的日志.我花了一整天时间来找出问题.如果我确实添加任何其他条件conditions array确实生效但不生效log_type.我打印查询日志,where clause总是显示log_type = '1'
我已经清除了缓存.任何帮助表示感谢,谢谢.
我在 Laravel 中集成了 sendgrid 并且我设法在电子邮件中发送了 sendgrid 的电子邮件模板,但我无法替换电子邮件模板中的内容。我正在使用 Sendgrid Web API V3。
我按照下面链接中给出的步骤操作,但它没有用我的动态数据替换模板中的变量。
链接:如何将动态数据传递到在 sendgrid webapp 上设计的电子邮件模板?:-| 发送网格
这是代码
$sg = new \SendGrid('API_KEY');
$request_body = json_decode('{
"personalizations":[
{
"to":[
{
"email":"example@example.com"
}
],
"subject":"Hello World from the SendGrid PHP Library!"
}
],
"from":{
"email":"from@example.com"
},
"content":[
{
"type":"text/html",
"value":"<html><body> -name- </body></html>"
}
],
"sub": {
"-name-": ["Alice"]
},
"template_id":"xxxxxx-xxx-xxxxxxxx"
}');
$mailresponse = $sg->client->mail()->send()->post($request_body);
echo $mailresponse->statusCode();
echo $mailresponse->body();
echo $mailresponse->headers();
Run Code Online (Sandbox Code Playgroud)
请帮忙。
我需要帮助来找出问题所在.我正在使用流明(laravel 5.1)为移动应用程序创建Web服务.我正在使用JWT进行身份验证,它返回一个令牌.
第一个问题是,如果我使用来自另一个系统/设备的相同令牌,则它会验证并返回所请求的信息.我希望该令牌仅对用户获取令牌的设备/系统有效.
第二个问题是我在JWT令牌中添加了一些自定义声明.我想从令牌获取自定义声明值.我发现类似的问题从使用Owin的JWT获取自定义声明,但没有得到我如何在PHP中使用它.
请帮我解决.
我正在我的 cakephp 应用程序中使用 auth 组件实现 Ajax 登录。除了记住我之外,一切都很好。
我正在尝试使用 Cookie 组件设置 cookie,但似乎它没有发送带有响应的 cookie。
我尝试过其他设置域、路径和用户代理在会话变量中检查 false 但它没有用。
如果我使用setcookie方法,那么它会发送 cookie 作为响应(但我需要 cakephp cookie,因为我正在 cookie 中保存数组)
下面是我正在使用的代码:
public function beforeFilter() {
parent::beforeFilter();
$this->Cookie->path = '/';
$this->Cookie->httpOnly = true;
if (!$this->Auth->loggedIn() && $this->Cookie->read('rememberMe')) {
$cookie = $this->Cookie->read('rememberMe');
$user = $this->User->find('first', array(
'conditions' => array(
'User.username' => $cookie['username'],
'User.password' => $cookie['password']
)
));
if ($user && !$this->Auth->login($user['User'])) {
$this->redirect(array('action' => 'logout')); // destroy session & cookie
} else {
$this->redirect($this->Auth->redirectUrl()); // redirect to Auth.redirect …Run Code Online (Sandbox Code Playgroud) php ×4
cakephp ×2
ajax ×1
cakephp-2.0 ×1
cookies ×1
email ×1
jquery ×1
jwt ×1
laravel-5.1 ×1
lumen ×1
pagination ×1
paginator ×1
sendgrid ×1