真人网上娱乐双层foreach循环,取出key相等的元素,组成新数组返回,如何优化成一层循环?

( 真人网上娱乐 )

if($arr1 && $arr2) {

        foreach($arr1 as $key1 => $val1) {
            foreach($arr2 as $key2 => $val2) {
                if($val1['orderId'] == $val2['orderId']) {
                    $arr1[$key1]['transId'] = $val2['transId'];
                }
            }
        }
    }


if($arr1 && $arr2) {
    $ids = array_column($arr2,'orderId');
        foreach($arr1 as $key1 => $val1) {
           
            if(in_array($val1['orderId'] , $ids)) {
                $arr1[$key1]['transId'] = $val1['orderId'];
            }

        }
    }

$arr1 = array(
    array(
        'orderId' => 1,
    ),
    array(
        'orderId' => 2,
    ),
    array(
        'orderId' => 3,
    ),
    array(
        'orderId' => 4,
    ),
    array(
        'orderId' => 5,
    ),
    array(
        'orderId' => 6,
    ),
);
$arr2 = array(
    array(
        'orderId' => 2,
        'transId' => 100001,
    ),
    array(
        'orderId' => 4,
        'transId' => 100002,
    ),
    array(
        'orderId' => 5,
        'transId' => 100003,
    ),
);

if( $arr1 && $arr2) {
    // `orderId` used for index
    $index_key = 'orderId';
    $column_key = 'transId';
    $columns = array_column($arr2, $column_key, $index_key);

    foreach($arr1 as &$val){
        $_key = $val[$index_key];
        if( array_key_exists($_key, $columns) ) {
            $val[$column_key] = $columns[$_key];
        }
    }

    print_r($arr1);
}

(看完/读完)这篇文章有何感想! 真人网上娱乐的分享…

真人亚洲娱乐请问thinkphp这种情况U函数怎么生成?

( 真人亚洲娱乐 )

var id = 123;
XHR.open('get','{:U("shop/goods/type_del", array("id" => id))}',false);

这是js代码里面的,这个id是js的变量,我要怎么来生成url呢,感觉没有可能做到啊?

这种情况怎么办啊,U方法好像也无能为力了啊???

在线等高手解决?

U方法在JS的这种情况下是不是无能为力了啊!!!

{:U(“shop/goods/type_del”)?id=}id

这个只能自己拼凑了,或者看着不爽,就用js写个U方法相似的功能出来,记得以前的thinksns就是写了一个U方法…不过还是不太灵活

var id = 123;
XHR.open('get','{:U("shop/goods/type_del")}?id='+id,false);

这个只能自己拼凑,模板引擎编译的时候,id都还没赋值呢。

U("shop/goods/type_del")+'?id='+id

(看完/读完)这篇文章有何感想! 真人亚洲娱乐的分享…

真人娱乐PHP程序员学C语言?

( 真人娱乐 )

学完了C语言发现他啥都干不了呢?大家觉得学C对PHP有啥帮助吗,或者说可以做哪些比较牛或者有趣的事情

首先,c语言并不是啥也干不了,只是你的应用场合不对,其次对于php来说,c语言可以写它的拓展

可以看看这个,用C/C++拓展你的PHP

既然是写惯了PHP的人,初碰C语言,大概应该先玩玩CGI吧。CGI要玩其实很简单,把下面这个编译出来的可执行文件改名作test.cgi放到配置好的Apache的bin-cgi目录下面,然后访问http://localhost/bin-cgi/test.cgi就好:

// cflags: -o /var/www/cgi-bin/test.cgi

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
    printf("Content-Type: text/plain\n\n");

    char *qs = getenv("QUERY_STRING");
    if(!qs) exit(-1);

    char* equ = strchr(qs, '=');
    if(equ) *(equ++) = '\0';

    if(strcmp(qs, "name"))
        printf("Parameters incorrect.");
    else
        printf("Hello Mr./Mrs. %s", equ);

    return 0;
}

光学c当然啥也干不了,最多写个控制台计算器之类的而已。
c要和系统api结合起来,才能干些事情,不过说到底,这些功劳都是系统api的,与c关系不大。
结论你说的很对,学完c啥也干不了

你可以写个数据库,当然这个要结合系统API

学完C之后就可以很好的理解PHP的底层,对一些原来只知道用的东西能更好的理解它的原理

哎 说C语言啥都干不了?反过来说才对 C语言不能干什么
大神约翰卡马克的游戏引擎都是纯C的
C语言 能干什么 不重要 学编程C能让你彻底理解内存~彻底学会从程序的角度思考问题~
这时才是最重要的

你应该问:怎样才能用c做事?
php就是c写的,你说呢?

请用合适的语言做合适的事情
c语言特别适合写操作系统等性能要求较高的地方
这些地方要求c语言运行时尽可能小 所以c语言只用标准库真的是什么也干不了
不过操作系统 导出的api都是c语言的借口
买本 unix网络高级编程第一卷 或者 unix环境高级编程 看看 会有很大的帮助的

(看完/读完)这篇文章有何感想! 真人娱乐的分享…

真人娱乐php索引数组按需处理成关联数组?

( 真人娱乐 )

问题可能有些描述的不是很好,我简单举个栗子

//需求
$arr = array('100', '101', '102', '103', '104', '105');
$newArr = array(array('id'=>'100'), array('id'=>'101'), array('id'=>'102'), array('id'=>'103'), array('id'=>'104'), array('id'=>'105'));
//我的处理方式是
$newArr = [];
foreach($arr as $val) {
    $newArr[] = array('id'=>$val);
}

上述方法可以实现我的需求,还有什么其他方式可以实现?我找到一个内置函数array_chunk($arr, 1, true)但是,这个键名是设置不了的。

array_map()函数可以实现你的需求:

$arr = array('100', '101', '102', '103', '104', '105');
function make($v)
{
    return array('id'=>$v);
}

$newArr=array_map('make', $arr);
var_dump($newArr);
//多谢楼下坛友建议
$newArr=array_map(function ($v){return array('id'=>$v);},$arr);

补充下,上面的写法还可以用匿名函数使其更优雅。

(看完/读完)这篇文章有何感想! 真人娱乐的分享…

真人亚洲娱乐一个商品表需要销量这个字段吗?

( 真人亚洲娱乐 )

一个商品表需要销量这个字段吗?

根据表设计的范式 销量可以由订单记录得出(或者建一个商品每日效果表,记录每天的效率),但是这样在实际中却遇到了这样的问题?

怎么查询时怎么根据商品的销量排序呢,还有按点赞数排序呢,收藏数呢?想淘宝这样的怎么做呢?

销量是必须的,但是这一列可以不是实时的,你应该记上统计出这个数据的时候的时间。

我的建议是,你先给订单时间加index,然后每过一小时(这个时间看你的售货速度)统计一下cache下当时的销量,然后把销量和时间这两个列存下来。你在前端显示真实的销量的时候,就可以把cache的数据,加上cache之后发生的订单的总和相加。这样你过一段时间就incrementally地做一下,问题就解决了。

订单时间加index的意思就是说,你知道你目前的cache是到譬如说半个小时前,那你这样就很容易query出半个小时内发生的订单,每一次处理的数据都会非常少。因此这个系统的负担不会随着你订单的增加而变慢,你也不需要因为每一次订单就频繁的更改“销量”这个列而产生性能问题。

如果一秒钟就有几个人挤进来,那可能会总是有一点误差,不过稍微做点变通就解决了。

对于如何给销量排序,我觉得需要在缓存这一层来解决,不需要在数据库维护这个index。如果按照这种方法维护销量的话,虽然直接按照这个列排序是不正确的,但是他“基本正确”。对于这样的属性的数据有特殊的排序方法。其中的一种方法是,你做一个qsort的变形,但是用户看到哪里你才排序到哪里。通常你在前端让用户按照销量排序的话,他只会看最前面的或者最后面的。平摊到每一次查阅,复杂度基本是log(n)的。

这种方法基本上可以用到你的数据规模明显比淘宝少的时候。你真有了淘宝那么大的数据,那所有的事情都得改成分布式的。最后要么上spark,要么上sqlazure,要么上scope,做起来就差很远了。

表的设计应该按照实际情况来,如果这个字段用得频繁,考虑到查询效率可以增加。

  1. 在你有排序的场景下,销量字段是必须的,并且由于是经常更新的字段,很有可能会按实际情况拆分到子表里,举个例子,goods存储商品信息,goods_counter一对一goods表,并存储各种统计信息,包括不限于销量,查看数,收藏数,点赞数,并根据需要建立索引

  2. 很多实际的一定规模(用户数或者数据量)的系统,未必还会使用MySQL做排序,会把数据放入搜索引擎,比如elasticsearch, solr, sphinx等等,然后利用搜索引擎做排序

都按销量排序了,那就加上呗。

(看完/读完)这篇文章有何感想! 真人亚洲娱乐的分享…

真人亚洲娱乐配置apache的虚拟主机时出现这个是什么情况

( 真人亚洲娱乐 )

httpd.conf文件

#
# This is the main Apache HTTP server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see 
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do.  They're here only as hints or reminders.  If you are unsure
# consult the online docs. You have been warned.  
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path.  If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/foo.log"
# with ServerRoot set to "D:/server/apache" will be interpreted by the
# server as "D:/server/apache/logs/foo.log".
#
# NOTE: Where filenames are specified, you must use forward slashes
# instead of backslashes (e.g., "c:/apache" instead of "c:\apache").
# If a drive letter is omitted, the drive on which httpd.exe is located
# will be used by default.  It is recommended that you always supply
# an explicit drive letter in absolute paths to avoid confusion.

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path.  If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk.  If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
#
ServerRoot "D:/server/apache"

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to 
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80

#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
#LoadModule auth_digest_module modules/mod_auth_digest.so
#LoadModule authn_alias_module modules/mod_authn_alias.so
#LoadModule authn_anon_module modules/mod_authn_anon.so
#LoadModule authn_dbd_module modules/mod_authn_dbd.so
#LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authn_file_module modules/mod_authn_file.so
#LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
#LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
#LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
#LoadModule cache_module modules/mod_cache.so
#LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule cgi_module modules/mod_cgi.so
#LoadModule charset_lite_module modules/mod_charset_lite.so
#LoadModule dav_module modules/mod_dav.so
#LoadModule dav_fs_module modules/mod_dav_fs.so
#LoadModule dav_lock_module modules/mod_dav_lock.so
#LoadModule dbd_module modules/mod_dbd.so
#LoadModule deflate_module modules/mod_deflate.so
LoadModule dir_module modules/mod_dir.so
#LoadModule disk_cache_module modules/mod_disk_cache.so
#LoadModule dumpio_module modules/mod_dumpio.so
LoadModule env_module modules/mod_env.so
#LoadModule expires_module modules/mod_expires.so
#LoadModule ext_filter_module modules/mod_ext_filter.so
#LoadModule file_cache_module modules/mod_file_cache.so
#LoadModule filter_module modules/mod_filter.so
#LoadModule headers_module modules/mod_headers.so
#LoadModule ident_module modules/mod_ident.so
#LoadModule imagemap_module modules/mod_imagemap.so
LoadModule include_module modules/mod_include.so
#LoadModule info_module modules/mod_info.so
LoadModule isapi_module modules/mod_isapi.so
#LoadModule ldap_module modules/mod_ldap.so
#LoadModule logio_module modules/mod_logio.so
LoadModule log_config_module modules/mod_log_config.so
#LoadModule log_forensic_module modules/mod_log_forensic.so
#LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule mime_module modules/mod_mime.so
#LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule negotiation_module modules/mod_negotiation.so
#LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
#LoadModule reqtimeout_module modules/mod_reqtimeout.so
#LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
#LoadModule speling_module modules/mod_speling.so
#LoadModule ssl_module modules/mod_ssl.so
#LoadModule status_module modules/mod_status.so
#LoadModule substitute_module modules/mod_substitute.so
#LoadModule unique_id_module modules/mod_unique_id.so
#LoadModule userdir_module modules/mod_userdir.so
#LoadModule usertrack_module modules/mod_usertrack.so
#LoadModule version_module modules/mod_version.so
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
###加载PHP模块
LoadModule php5_module 'd:/server/php/php5apache2_2.dll'

###加载PHP配置文件
PHPIniDir "D:\server\php"

###只要是 .PHP格式的文件,都交给PHP模块去处理
AddType application/x-httpd-php .php



<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.  
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User daemon
Group daemon

</IfModule>
</IfModule>

# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition.  These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#

#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed.  This address appears on some server-generated pages, such
# as error documents.  e.g. admin@your-domain.com
#
ServerAdmin 470266001@qq.com

#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
###允许通过域名进行访问
ServerName www.ws.com:80

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "D:/server/apache/htdocs"

#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories). 
#
# First, we configure the "default" to be a very restrictive set of 
# features.  
#
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#

#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "D:/server/apache/htdocs">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all

</Directory>

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

#
# The following lines prevent .htaccess and .htpasswd files from being 
# viewed by Web clients. 
#
<FilesMatch "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</FilesMatch>

#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "logs/error.log"

#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn

<IfModule log_config_module>
    #
    # The following directives define some format nicknames for use with
    # a CustomLog directive (see below).
    #
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
      # You need to enable mod_logio.c to use %I and %O
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>

    #
    # The location and format of the access logfile (Common Logfile Format).
    # If you do not define any access logfiles within a <VirtualHost>
    # container, they will be logged here.  Contrariwise, if you *do*
    # define per-<VirtualHost> access logfiles, transactions will be
    # logged therein and *not* in this file.
    #
    CustomLog "logs/access.log" common

    #
    # If you prefer a logfile with access, agent, and referer information
    # (Combined Logfile Format) you can use the following directive.
    #
    #CustomLog "logs/access.log" combined
</IfModule>

<IfModule alias_module>
    #
    # Redirect: Allows you to tell clients about documents that used to 
    # exist in your server's namespace, but do not anymore. The client 
    # will make a new request for the document at its new location.
    # Example:
    # Redirect permanent /foo http://www.ws.com/bar

    #
    # Alias: Maps web paths into filesystem paths and is used to
    # access content that does not live under the DocumentRoot.
    # Example:
    # Alias /webpath /full/filesystem/path
    #
    # If you include a trailing / on /webpath then the server will
    # require it to be present in the URL.  You will also likely
    # need to provide a <Directory> section to allow access to
    # the filesystem path.

    #
    # ScriptAlias: This controls which directories contain server scripts. 
    # ScriptAliases are essentially the same as Aliases, except that
    # documents in the target directory are treated as applications and
    # run by the server when requested rather than as documents sent to the
    # client.  The same rules about trailing "/" apply to ScriptAlias
    # directives as to Alias.
    #
    ScriptAlias /cgi-bin/ "D:/server/apache/cgi-bin/"

</IfModule>

<IfModule cgid_module>
    #
    # ScriptSock: On threaded servers, designate the path to the UNIX
    # socket used to communicate with the CGI daemon of mod_cgid.
    #
    #Scriptsock logs/cgisock
</IfModule>

#
# "D:/server/apache/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "D:/server/apache/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>

#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value.  If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain

<IfModule mime_module>
    #
    # TypesConfig points to the file containing the list of mappings from
    # filename extension to MIME-type.
    #
    TypesConfig conf/mime.types

    #
    # AddType allows you to add to or override the MIME configuration
    # file specified in TypesConfig for specific file types.
    #
    #AddType application/x-gzip .tgz
    #
    # AddEncoding allows you to have certain browsers uncompress
    # information on the fly. Note: Not all browsers support this.
    #
    #AddEncoding x-compress .Z
    #AddEncoding x-gzip .gz .tgz
    #
    # If the AddEncoding directives above are commented-out, then you
    # probably should define those extensions to indicate media types:
    #
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

    #
    # AddHandler allows you to map certain file extensions to "handlers":
    # actions unrelated to filetype. These can be either built into the server
    # or added with the Action directive (see below)
    #
    # To use CGI scripts outside of ScriptAliased directories:
    # (You will also need to add "ExecCGI" to the "Options" directive.)
    #
    #AddHandler cgi-script .cgi

    # For type maps (negotiated resources):
    #AddHandler type-map var

    #
    # Filters allow you to process content before it is sent to the client.
    #
    # To parse .shtml files for server-side includes (SSI):
    # (You will also need to add "Includes" to the "Options" directive.)
    #
    #AddType text/html .shtml
    #AddOutputFilter INCLUDES .shtml
</IfModule>

#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type.  The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile conf/magic

#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.ws.com/subscription_info.html
#

#
# MaxRanges: Maximum number of Ranges in a request before
# returning the entire resource, or one of the special
# values 'default', 'none' or 'unlimited'.
# Default setting is to accept 200 Ranges.
#MaxRanges unlimited

#
# EnableMMAP and EnableSendfile: On systems that support it, 
# memory-mapping or the sendfile syscall is used to deliver
# files.  This usually improves server performance, but must
# be turned off when serving from networked-mounted 
# filesystems or if support for these functions is otherwise
# broken on your system.
#
#EnableMMAP off
#EnableSendfile off

# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be 
# included to add extra features or to modify the default configuration of 
# the server, or you may simply copy their contents here and change as 
# necessary.

# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf

# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf

# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf

# Language settings
#Include conf/extra/httpd-languages.conf

# User home directories
#Include conf/extra/httpd-userdir.conf

# Real-time info on requests and configuration
#Include conf/extra/httpd-info.conf

# Virtual hosts
#Include conf/extra/httpd-vhosts.conf

# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf

# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf

# Various default settings
#Include conf/extra/httpd-default.conf

# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
#       starting without SSL on platforms with no /dev/random equivalent
#       but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

httpd-vhosts.conf文件信息:

#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at 
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
#<VirtualHost *:80>
#    ServerAdmin webmaster@dummy-host.ws.com
#    DocumentRoot "D:/server/apache/docs/dummy-host.ws.com"
#    ServerName dummy-host.ws.com
#    ServerAlias www.dummy-host.ws.com
#    ErrorLog "logs/dummy-host.ws.com-error.log"
#    CustomLog "logs/dummy-host.ws.com-access.log" common
#</VirtualHost>

#<VirtualHost *:80>
#    ServerAdmin webmaster@dummy-host2.ws.com
#    DocumentRoot "D:/server/apache/docs/dummy-host2.ws.com"
#    ServerName dummy-host2.ws.com
#    ErrorLog "logs/dummy-host2.ws.com-error.log"
#    CustomLog "logs/dummy-host2.ws.com-access.log" common
#</VirtualHost>

#配置一个book.ws.com的虚拟主机
<VirtualHost *:80>
    ServerName book.ws.com
    DocumentRoot "D:/server/apache/htdocs/book"
</VirtualHost>

我找到问题原因了,是因为我没有在httpd.conf中加载Include conf/extra/httpd-vhosts.conf

贴出你的Apache配置文件

何必呢 ,用 wdcp 一键搞定

(看完/读完)这篇文章有何感想! 真人亚洲娱乐的分享…

真人娱乐关于thinkphp的一个奇葩的问题

( 真人娱乐 )

修改数据,添加了两个字段分别为,use_coin 和 get_coin,然后打印出来组成的数组$data含有 这两个字段的值,但是使用save($data)时却没有成功,打印最后执行的语句时却没有这两个值。求解~
这么说:

1.原来增删改查正常
2.现表中添加两个字段use_coin 和 get_coin.
3.增改时post到的数据中可以获取到这个值。
4.但是执行save($data)后是这个两个值并没有起作用,其他字段都可以
5.打印$data包含这两个值,但是打印最后执行sql却没有这两个值。

问:cache目录已经删除过,问题出在哪里?什么原理?求解~

这个的问题

define(‘APP_DEBUG’,False);

应该改成

define(‘APP_DEBUG’,True);

更多的信息请参阅 ThinkPHP的调试模式。

写条件了吗 描述在详细点啊

可能有缓存,建议清除缓存 cache 目录试试

删cache没有用,cache缓存的是页面,把runtime下面的fields目录干掉。

(看完/读完)这篇文章有何感想! 真人娱乐的分享…

真人网上娱乐SQLite数据库如何存储图片/语音

( 真人网上娱乐 )

请问如何利用sqlite的blob类型存储图片语音文件。
已知目前接收到的是一个图片或者语音的url地址,能否在存入sqlite数据库的时候把图片或者语音通过接收到的url地址存储到sqlite数据库中。
谢谢。

1、HttpConnect获取图片数据;

2、将图像数据转换二进制写入数据库
ContentValues values = new ContentValues();
final ByteArrayOutputStream os = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.PNG, 100, os);
values.put(“express_img”, os.toByteArray());
values.put(“express_name”,”zf”);
values.put(“express_no”,”zf”);
getContentResolver().insert(“express”, values);

3、从SQLite中读取Bitmap
byte[] in=cur.getBlob(cur.getColumnIndex(“express_img”));
bmpout=BitmapFactory.decodeByteArray(in,0,in.length);

4、 显示在ImageView上

ImageView imageView = (ImageView) view.findViewById(R.id.img);
ByteArrayInputStream stream = new ByteArrayInputStream(cur.getBlob(cur.getColumnIndex(“express_img”)));
imageView.setImageDrawable(Drawable.createFromStream(stream, “img”));

    $url = "http://....../logo.png";
    $handle = fopen($url,"rb");
    $contents = fread($handle,filesize($url));

var_dump($contents);
为什么这样把一个url的图片读取为二进制,输出$contents为:bool(false)

(看完/读完)这篇文章有何感想! 真人网上娱乐的分享…

真人网上娱乐PHP微信 图文消息详情页

( 真人网上娱乐 )

图1,是别人的公众号图文消息详情页,点击右上角会有很多内容,包括分享到朋友圈.
图2,是我的公众号图文消息详情页,点击右上角就2个内容,内容页面是我自己的模板.
请问这是为什么,是不是要在页面模板里添加什么东西

可以说是的。

详情见微信公众平台的jssdkjssdk说明

(看完/读完)这篇文章有何感想! 真人网上娱乐的分享…

真人娱乐Yii2中数据模型问题

( 真人娱乐 )

RT,刚开始用Yii2,现在想把一些个默认的数据保存在数据表中(setting),如站点信息、模板设置等,表分为俩字段 key => value,我现在的代码是:

写一个 Setting ActiveReocrd 放入 common\models 中;
然后几个站点信息、模板设置这几个都设置为 Model,主要为为了表单和验证。

请问,怎样的方式是否主流和优雅?如果不是,请大家提点。

首先不要重复造轮子,除非你造的轮子更加优秀。

现在想把一些个默认的数据保存在数据表中(setting),如站点信息、模板设置等,表分为俩字段 key => value

这个功能可以使用现成的: https://github.com/funson86/yii2-setting

(看完/读完)这篇文章有何感想! 真人娱乐的分享…

真人娱乐php如何把表单接收到的一些字段转化为图片保存?

( 真人娱乐 )

表单接收到的一些字段,比如qq号什么的,接收后保存在数据库的同时,再转化为图片保存一份,有什么工具包之类的东西么?

你需要看一下php GD库,很容易

是直接将号码写到图片上面?如果是这样的话,实现的原理和验证码是一样的。如果说是生成图片的编码话,额,这个我也想知道,题主弄成功告诉我一下

(看完/读完)这篇文章有何感想! 真人娱乐的分享…

真人网上娱乐php加载时间的问题

( 真人网上娱乐 )

一个页面加载a.php和b.php,a.php用10ms,b.php用1s。交换ab代码,时间几乎不变。新建c.php把b.php代码拷贝过去,改用c.php,c用时也差不多10ms…
这个可能是什么原因…
add,时间都耗在waiting那里…

一直这样子吗?

(看完/读完)这篇文章有何感想! 真人网上娱乐的分享…

真人网上娱乐在乌云上看到的,一个线程并发漏洞,有人愿给讲讲原理和修复方案吗?

( 真人网上娱乐 )

在乌云上看到的,一个线程并发漏洞,有人愿给讲讲原理和修复方案吗?

http://www.wooyun.org/bugs/wooyun-2010-0102881

而是在发送的请求读数据时未及时锁住数据信息导致可多线程并发多次利用优惠劵。
这个BUG如何理解呢?难道是开多个浏览器同时使用优惠券吗?如何堵住BUG呢?

这个bug是没及时修改优惠券状态所致的。
第二次请求的时候,第一次请求还没来得及把优惠券的状态改成”已使用“,导致第二次也可以使用优惠券。

这是一个逻辑不严谨导致的bug, 跟线程互斥没什么关系。

防止这个bug的方法,就是保证及时修改优惠券的状态。

关于如何制造这个bug的方法很多, 很多语言都有多线程\多进程功能, 开起来同时请求就行了。
甚至题主说的用多开浏览器请求也是可以的。

跟你简单的说吧,你现在去买东西,掏钱才给你开门,你掏了钱,门开了,忽然你的东西掉了(不要问怎么掉了),你低下头去捡东西(店门没关,线程没锁),这时候B君进来拿走了你要的东西,此时你抬头,也询问你的东西,店家还是乖乖给了你…而且这段门敞开的时间,多个线程都可能抢占,仅仅只有一个线程触发了交易完成,店家才知道,完成了交易,这时候,剩下的线程才进不来(具体那个线程触发这个关门操作都是随机的,跟计算机当时的状态都有关,因为线程执行是不断切换的)关闭店门,在这段时间内ABCDE君都可能免费拿到东西.

一般支付流程如下:

  1. 读取余额

  2. 判断是否大于0

  3. 余额减一

  4. 写回余额

当两个线程同时执行,假设余额为1,两个线程并发执行(假设第二个线程落后于第一个),第二个线程在第一个线程将写回余额之前读取了余额,那么线程二也会判断成功,照样会执行购买成功的流程。
设计的好一点儿的情况是,结果数据库里的结果是-1,坏一点儿的情况是数据库里的的结果是0 (因为第二个线程读取的是1,减一之后写回所以是0).

解决方案就是加锁,在线程一读取余额之前加锁,让要读取余额的线程二挂起等待线程一写回余额再读取。
所有数据库都可能存在这样的情况,有人用来取现的。http://www.wooyun.org/bugs/wooyun-2015-099622

(看完/读完)这篇文章有何感想! 真人网上娱乐的分享…

真人娱乐写了一个PHP程序,本地测试正常,传到主机上就出问题了

( 真人娱乐 )

我写的是ajax,其中的php代码有一句数据库查询语句

` $sql = “SELECT * FROM user WHERE name =
‘”.$_SESSION[‘username’].”‘”; ` 这里面的 $_SESSION[‘username’]
是我保存的登录用户的登录昵称。本地测试是可以输出的正常的,一到服务器上就是NULL。

如果所有的 $_SESSION[‘username’] 都是空也就算了…只有几处是空的,而且上下都没有和他有关系的代码。

我到底改如何调试这种问题?

是不是 $_SESSION 用多了的问题?但是我在文件的起头定义一个变量存这个,内容是有的。但是吧这个变量写到下面去,有的地方还是Null

大家不要回答了,对不起是我傻逼了,本地我在php页面没有加session_start() 而在header.php加,是正常的。
服务器上必须在php页面加session_start(); 奇怪

session_start了吗

开浏览器开发者工具, 看浏览器传了哪些cookie过去
再看一下php代码得到的cookie是什么 (远程调试, 或者print_r)
如果cookie无问题但是session仍然不正常, 检查session设置

(看完/读完)这篇文章有何感想! 真人娱乐的分享…

真人娱乐如何自己搭建在线代码编译器?

( 真人娱乐 )

想自己搭一个类似 codepad 的在线编译器
可以在线编译 php ruby python 等代码块

开始的思路是 在centos 里安装一个PHP环境 php执行shell_exec(“docker run -v “$(pwd)”:/usr/src/app -w /usr/src/app docker.io/php php index.php “);

能正常执行 可是花了5秒多的时间太不划算了,看来其他在线编译器速度都很快,他们是如何实现的呢?有没有大神具体分享下代码或者思路

(看完/读完)这篇文章有何感想! 真人娱乐的分享…

真人亚洲娱乐laravel中针对session操作的flash类型函数翻译问题?

( 真人亚洲娱乐 )

为什么有些文档(https://laravel-china.org/doc…会把它翻译为闪存?
有些地方又把它翻译为清除
究竟应该选择哪个?

明白意思就行了,不要太计较各家的翻译。
对于你这个问题本身,flash在这里当动词用的,即一次性存储,翻译成“闪存”很恰当。
翻译成“清除”是啥意思,clear的意思,但是这里是 store (once)。本意是“存储”的意思,翻译成“删除”的意思很不合理。第二个翻译的前两个可以说是翻译错误,而其意思恰恰跟翻译的完全相反。第三个 flashExcept 勉强算正确,确实是清除了除了指定的其他的输入,但是flashExcept的目的不仅是清除,更多的是为了闪存指定的输入值。

英译中总会有点出入,所以这就是很多人书的读英文原版书的好处。

针对你的问题,如果你已经知道了 flash 的用法,其实就可以了,翻译难免有出入,跟人沟通的时候也直接说 flash 了,不是一定非要说中文的。

就好比,你知道了 session(会话),不管是写代码,写文章,跟人沟通,直接说(写)出 session,其他人也是可以理解意思的。

(看完/读完)这篇文章有何感想! 真人亚洲娱乐的分享…

真人娱乐如何在php環境 發表文章到facebook fan page?

( 真人娱乐 )

請問有沒有人知道如何在php環境下
發表文章到facebook fan page?
我是在這裡發現這個功能
http://stackoverflow.com/ques…
但是它上面做的似乎只是一小部分…並不是完整的方法
想請問有沒有一條龍的方式?

官方文档说的很清楚了
https://developers.facebook.c…

(看完/读完)这篇文章有何感想! 真人娱乐的分享…

真人娱乐七牛云的内容管理一栏是否不能显示Js文件?怎么没有见到?只是见到图片,CSS文件?问题已解决!

( 真人娱乐 )

使用7牛云后,网站上的JS都不能加载,但是见到就是浏览器控制台看到了服务器是七牛云,但是在七牛云内容管理并没有见到Js的文件,请问各位大神怎么解决这个问题?另外网上有写教程,在缓存中去掉JS、CSS。

(看完/读完)这篇文章有何感想! 真人娱乐的分享…