最近新的php7已经发布.但是,当我尝试安装gd包时,找不到该库.
我试过了
sudo apt-get install php70-gd
Run Code Online (Sandbox Code Playgroud)
和
sudo apt-get install php70-php-gd
Run Code Online (Sandbox Code Playgroud)
有没有人知道gd是否适用于php 7?
我试图在我的电子邮件模板中有一个链接,看起来像这样:
<a href={{url}}>click here</>
Run Code Online (Sandbox Code Playgroud)
上面的链接已通过添加“自定义”链接添加到“设计器”中。这个值就像我输入的 {{url}}。
我在 dynamic_template_data 中传递一个 url 值,如下所示:
const msg = {
to: savedAdmin.email,
from: process.env.EMAIL_ADDRESS,
templateId: process.env.SENDGRID_NEW_ADMIN_TEMPLATE_ID,
personalizations: [
{
to: [{email: savedAdmin.email}],
dynamic_template_data: {
name: savedAdmin.first_name,
url: process.env.CMS_URL,
email: savedAdmin.email,
password: randomPassword,
},
},
],
};
Run Code Online (Sandbox Code Playgroud)
但是,当我在收件箱中收到邮件时,网址会呈现如下:
http://url9905.myweb.shop/ls/click?upn=BMmHdsRoNrbb0-2FMI-2BBVvCjpDiCceHLG5U2u5OCf29QV6iCtfuvZYId1FE95cTz9uyMY31z9fQ7iR-2BPgq-2FkquvxdAPC0oMKiLa3DRglYUSVP-2FRmYbDQ-2BdFGnczXk75K3Ym8rSodsrAy-2BfNDJwqA7RDeemPFjepjRsUdci9CA6Y0-....
Run Code Online (Sandbox Code Playgroud)
我如何让这个工作?
我有一个端点,用户和来宾(未经过身份验证)都可以将数据发布到:
async create(
@requestBody({
content: {
'application/json': {
schema: {
type: 'object',
properties: {
create_account: {type: 'boolean'},
password: {type: 'string'},
password_repeat: {type: 'string'},
currency: {type: 'string'},
payment_method: {type: 'string'},
products: {type: 'array'},
voucher: {type: 'string'},
customer: {type: 'object'},
news_letter: {type: 'boolean'},
},
},
},
},
})
@inject(SecurityBindings.USER) currentUserProfile: UserProfile,
order: Omit<Order, 'id'>,
): Promise<{url: string}> {
const userId = currentUserProfile[securityId];
}
Run Code Online (Sandbox Code Playgroud)
但是,我不确定如何从会话中获取登录用户,因为我收到以下错误:
The key 'security.user' is not bound to any value in context
Run Code Online (Sandbox Code Playgroud)
在这种情况下如何获取用户 ID?
如果我只有IP地址,如何列出文件和文件夹?
使用urllib和其他人,我只能显示index.html文件的内容.但是,如果我想查看根目录中的哪些文件呢?
我正在寻找一个示例,说明如何在需要时实现用户名和密码.(大多数时候index.html是公共的,但有时其他文件不是).
可以说我有一个像这样的html页面:
<html>
<head></head>
<body>
Hello World!
<div> my other content </div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我如何从DOM Crawler获得"Hello World"?
我认为这会奏效:
$crawler = $crawler
->filter('body > div');
->reduce(function (Crawler $node, $i) {
return false;
});
Run Code Online (Sandbox Code Playgroud)
但这显然会出错:
InvalidArgumentException: "The current node list is empty"
Run Code Online (Sandbox Code Playgroud) 是否可以通过多个实体管理器解析目标实体?
我有一个班级人员(在一个可重复使用的包中):
/**
*
* @ORM\Entity
* @ORM\Table(name="my_vendor_person")
*/
class Person
{
/**
* Unique Id
*
* @var integer $id
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* First Name
*
* @var string $name
*
* @ORM\Column(name="first_name", type="string", length=32)
*/
protected $firstName;
// etc...
Run Code Online (Sandbox Code Playgroud)
和一个类用户(在我的主应用程序中):
/**
* @ORM\Entity
*
* @ORM\Table(name="my_financial_user")
*
*/
class User extends BaseUser
{
/**
* @ORM\OneToOne(targetEntity="My\FinancialBundle\Model\PersonInterface")
* @var PersonInterface
*/
protected $person;
Run Code Online (Sandbox Code Playgroud)
基本上我想将用户从可重用的包中耦合到一个人.
我在doctrine的配置中设置了解决目标实体选项,我认为它允许我这样做:
doctrine:
orm:
auto_generate_proxy_classes: "%kernel.debug%" …Run Code Online (Sandbox Code Playgroud) 使用 excel4node 我可以将文件写入硬盘。但我想将其作为下载返回,而不将文件保存在服务器上。我认为以下代码是必需的,但不确定如何使用它:
wb.writeToBuffer().then(function(buffer) {
console.log(buffer);
});
Run Code Online (Sandbox Code Playgroud)
有人对此有什么想法吗?
我正在尝试从我的reducer更新我的redux模型。该模型是Immutable Record类的扩展。我正在尝试使用set方法更新Record:
import { List, Record } from 'immutable';
import { IFaqItem } from './api.models';
export interface IFaqsState {
loading?: boolean;
items?: List<IFaqItem>;
}
const faqsState = Record({
loading: false,
items: List()
});
class FaqsState extends faqsState implements IFaqsState {
loading: boolean;
items: List<IFaqItem>;
with(props: IFaqsState) {
this.set('loading', props.loading);
return this;
}
}
export default FaqsState;
Run Code Online (Sandbox Code Playgroud)
减速器包含以下内容:
case ActionTypes.FAQS_GET_AJAX_RECEIVE:
let response: IFaqsGetResponse = action.payload.response && action.payload.response.response;
return state.with({
loading: false,
items: List(response)
});
Run Code Online (Sandbox Code Playgroud)
但是,这给了我以下错误:
Error: Cannot set on an immutable …Run Code Online (Sandbox Code Playgroud) 我正在做一个
console.log(process.env.TZ);
console.log(new Date());
Run Code Online (Sandbox Code Playgroud)
它输出
Europe/Amsterdam
2018-09-02T08:07:03.842Z
Run Code Online (Sandbox Code Playgroud)
但目前的时间是10:07而不是08:07.
实际的问题是,当我将模型保存到数据库时,它会以某种方式转换为UTC,这不是我想要的.它就像order.delivery_date = 2018-08-06 10:00:00; order.save().当我查看数据库时,它说08:00:00.我该如何防止这种情况发生?
我正在使用Loopback 3和MySQL.
我一直无法根据对象数组中的属性查询对象。
我正在尝试查询具有 ID 为 7 的事件的所有订单:
const orders = await this.orderRepository.find({where: {events: {elemMatch: {'id': event.id}}}});
Run Code Online (Sandbox Code Playgroud)
以上给了我以下错误:
ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''{\"id\":\"7\"}
Run Code Online (Sandbox Code Playgroud)
如果我尝试以下过滤器,我总是会得到一个空数组:
{where: {events: {like: '%id%'}}}
Run Code Online (Sandbox Code Playgroud)
Loopback 4 的正确方法是什么?
更新:
我正在使用 MySQL 8.0。
这是我的订单模型中事件的定义:
@property({
type: 'array',
itemType: 'object',
required: false,
})
events: CartItem[] | null;
Run Code Online (Sandbox Code Playgroud) loopback4 ×2
node.js ×2
symfony ×2
date ×1
directory ×1
doctrine-orm ×1
excel4node ×1
gd ×1
html ×1
immutable.js ×1
ip-address ×1
javascript ×1
loopbackjs ×1
mysql ×1
php ×1
python ×1
reactjs ×1
redux ×1
sendgrid ×1
utc ×1
web-crawler ×1