我遇到以下错误来自" http://static.example.com "的字体已被阻止通过跨源资源共享策略加载:请求中没有"Access-Control-Allow-Origin"标头资源.因此,不允许来源" http://www.example.com "访问.
我在下面的.htaccess文件中使用以下COR设置
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 1 month"
ExpiresByType text/cache-manifest "access plus 0 seconds"
........
<IfModule mod_headers.c>
Header append Cache-Control "public"
<FilesMatch "\.(ttf|otf|eot|woff|svg)$">
SetEnvIf Origin "^http://(.*)?example.com$" origin_is=$0
Header set Access-Control-Allow-Origin %{origin_is}e env=origin_is
</FilesMatch>
<FilesMatch "\.(js|css|xml|gz)$">
Header append Vary: Accept-Encoding
</FilesMatch>
</IfModule>
</IfModule>
Run Code Online (Sandbox Code Playgroud)
我需要帮助
我需要帮助完整安装PHP7(ZTS)+ Pthreads.我尝试了以下安装,但无法使其正常工作.
sudo -i
apt-get update
apt-get install -y git bison autoconf build-essential pkg-config gitcore libltdl-dev libbz2-dev libxml2-dev libxslt1-dev libssl-dev libicu-dev libpspell-dev libenchant-dev libmcrypt-dev libpng-dev libjpeg8-dev libfreetype6-dev libmysqlclient-dev libreadline-dev libcurl4-openssl-dev
mkdir /etc/php7
mkdir /etc/php7/cli
cd /usr/local/src
git clone https://github.com/php/php-src.git --depth=1
cd php-src/ext
git clone https://github.com/krakjoe/pthreads -b master pthreads
cd ..
./buildconf --force
php_configure_args="--prefix=/etc/php7 --with-config-file-path=/etc/php7/cli --with-config-file-scan-dir=/etc/php7/cli/conf.d --with-bz2 --with-zlib --enable-zip --with-mcrypt --with-openssl --with-curl --enable-ftp --with-mysqli --enable-sockets --enable-pcntl --with-pspell --with-enchant --with-gettext --with-gd --enable-exif --with-jpeg-dir --with-png-dir --with-freetype-dir --with-xsl --enable-bcmath --enable-mbstring --enable-calendar --enable-sysvmsg --enable-sysvsem --enable-sysvshm …Run Code Online (Sandbox Code Playgroud) 我希望能够使用指针运算符对动态生成的值进行对象引用
//Jobs
class Jobs
{
private $orderid;
private $quantity;
private $contactno;
private $contactname;
}
Run Code Online (Sandbox Code Playgroud)
因此我将创建对象键
$keys = array(
'orderid',
'quantity',
'contactno',
'contactname'
);
Run Code Online (Sandbox Code Playgroud)
然后做
$size = 4;
$i = 0;
//object instantiation
$jobObject = new Jobs();
$row = array('894949','45','08097577580','Emi');
for($i=0;$i<$size;$i++){
//This is my challenge
$jobObject->$keys[$i] = $row[$i];
}
Run Code Online (Sandbox Code Playgroud)
我非常确定应该有一种方法来获取 $keys[$i] 的值,该值可以由“$jobObject->”引用来进行对象属性初始化。
我尝试用大括号将 $keys[$i] 括起来
$jobObject->{$keys[$i]} = $row[$i];
Run Code Online (Sandbox Code Playgroud)
但它会抛出错误。请我需要帮助以了解如何使其正常工作或出路。