1.我想做什么:
我有一个域example.me,以及一个子域text.example.me,该域托管在Windows Server上。它使用php 5.6运行Apache
我想使用Let's Encrypt和此工具https://github.com/PKISharp/win-acme安装和SSL证书
2.问题:
它似乎无法正常工作,尝试访问https://test.example.me时出现以下错误
该网站无法提供安全的连接
3.我到目前为止所做的
我遵循以下步骤进行操作:https : //commaster.net/content/how-setup-lets-encrypt-apache-windows
这是我的httpd-ssl.conf的内容
<VirtualHost *:443>
ServerAdmin me@examole.com
ServerName text.example.me
DocumentRoot "D:/xampp/htdocs"
RewriteEngine On
# Redirect to the correct domain name
RewriteCond %{HTTP_HOST} !^test.example.me$ [NC]
RewriteRule ^/?(.*)$ https://test.example.me/$1 [NE,L,R=301]
Alias /.well-known D:/xampp/htdocs/.well-known
SSLEngine on
SSLCertificateFile "conf/ssl.crt/text.example.me-crt.pem"
SSLCertificateKeyFile "conf/ssl.key/test.example.me-key.pem"
SSLCertificateChainFile "conf/ssl.csr/ca-test.example.me-crt.pem"
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
我的80,443个端口可用,但Skype没有使用它,所以这不是问题。
这是我的httpd-vhosts.conf的内容
<VirtualHost *:80>
ServerAdmin me@example.me
ServerName test.example.me
RewriteEngine On
# Redirect to the HTTPS site
RewriteCond %{HTTPS} …Run Code Online (Sandbox Code Playgroud) 我有一个自定义用户角色,称为form_editor.我希望这个用户只能编辑联系表格7.
这就是我到目前为止所拥有的
$form_editor_role = add_role(
'form_editor',
__( 'Form Editor' ),
array(
'read' => true, // true allows this capability
'edit_posts' => true,
'delete_posts' => false, // Use false to explicitly deny
)
);
$role = get_role( 'form_editor' );
if(!$role->has_cap('cfdb7_access')){
$role->add_cap( 'cfdb7_access' );
}
Run Code Online (Sandbox Code Playgroud)
是的,它不能访问帖子.它具有对联系表单的查看权限,但没有编辑权限.
我有一个在php 7.2上运行的应用程序,需要使用以下条件对字符串进行加密:
我已经知道应该得到的输出,但是我的脚本会返回所有不同的字符串,由于IV(openssl_random_pseude_bytes),我认为我并不能真正理解它的逻辑。我对加密没有足够的经验,因此无法弄清楚。
$string = 'my-string';
$cipher = 'BF-CFB';
$key = 'my-secret-key';
$ivlen = openssl_cipher_iv_length($cipher);
$iv = openssl_random_pseudo_bytes($ivlen);
$encrypted = base64_encode(openssl_encrypt($string, $cipher, $key, OPENSSL_RAW_DATA, $iv));
Run Code Online (Sandbox Code Playgroud)
例
加密的目的是为了访问API,并且提供了用C#编写的加密方法示例。问题是该脚本每次都与我的脚本生成相同的字符串。我必须构建自己的脚本,以便获得与提供的官方示例相同的结果(这是一个代码段:)
public new int Encrypt(
byte[] dataIn,
int posIn,
byte[] dataOut,
int posOut,
int count)
{
int end = posIn + count;
?
byte[] iv = this.iv;
?
int ivBytesLeft = this.ivBytesLeft;
int ivPos = iv.Length - ivBytesLeft;
?
// consume what's left in the IV buffer, but make sure …Run Code Online (Sandbox Code Playgroud) 我正在构建一个获取产品的脚本,我被困在以编程方式添加属性的部分。所以基本上我想检查一个属性是否存在,如果不存在则添加它。然后检查它的价值是否存在,如果不存在,他们添加它的价值,并将所有东西附加到我的产品上。
这是我获得产品的格式:
[attributes] => Array
(
[0] => stdClass Object
(
[id] => 332
[name] => Gender
[value] => Woman
)
[1] => stdClass Object
(
[id] => 333
[name] => Wheel Size
[value] => 28 Inch
)
[2] => stdClass Object
(
[id] => 334
[name] => Frame height
[value] => 56 cm
)
Run Code Online (Sandbox Code Playgroud)
现在我已经尝试了 2 个版本,我将粘贴两个代码示例。
版本 1:
foreach($product->attributes as $attribute) {
$slug = 'pa_' . strtolower($attribute->name);
$attribute_name = $attribute->name;
$attribute_value = $attribute->value;
$permalinks = get_option( 'woocommerce_permalinks' ); …Run Code Online (Sandbox Code Playgroud) 我正在尝试运行查询,但发生了一些奇怪的事情:
$return = MyCustomPage::get()->where(
" MyCustomPage.ID IN(" . implode(',', $MyCustomPageIds) . ")"
)->limit(2);
Run Code Online (Sandbox Code Playgroud)
这会返回一个错误,因为查询它试图从MyCustomPage_Live而不是MyCustomPage获取数据.
这个逻辑就像改变一样,有时它从一个表有时从另一个表中获取,我需要在查询中指定表名(例如MyCustomPage.ID或MyCustomPage_Live.ID)
对于这个或任何解决方案有更好的方法吗?
php ×3
wordpress ×2
apache ×1
c# ×1
cryptography ×1
encryption ×1
lets-encrypt ×1
mysql ×1
silverstripe ×1
ssl ×1
woocommerce ×1