• 关于

    do_foo

    的搜索结果

回答

drop table if exists foo; create table foo ( id int unsigned not null auto_increment primary key, val smallint unsigned not null default 0 ) engine=innodb; drop procedure if exists load_foo_test_data; delimiter # create procedure load_foo_test_data() begin declare v_max int unsigned default 1000; declare v_counter int unsigned default 0; truncate table foo; start transaction; while v_counter < v_max do insert into foo (val) values ( floor(0 + (rand() * 65535)) ); set v_counter=v_counter+1; end while; commit; end # delimiter ; call load_foo_test_data(); select * from foo order by id;来源:stack overflow
保持可爱mmm 2020-05-16 22:02:45 0 浏览量 回答数 0

问题

type(my_function)比较类型

我有一个函数,应该根据传递给它的参数类型进行操作,简单说明一下: def operate_according_to_type(argument_passed): if type(argu...
is大龙 2020-03-24 12:30:14 2 浏览量 回答数 1

问题

Ruby-SDK之如何实现管理文件?

一个Bucket下可能有非常多的文件,SDK提供一系列的接口方便用户管理文件。 查看所有文件 通过Bucket#list_objects来列出当前Bucket下的所有文件。主要的参数如下: :prefix...
青衫无名 2019-12-01 21:46:37 1098 浏览量 回答数 0

万券齐发助力企业上云,爆款产品低至2.2折起!

限量神券最高减1000,抢完即止!云服务器ECS新用户首购低至0.95折!

回答

temp schema是在使用GP数据库时产生的正常临时表文件,用这个脚本清理:psql -Atc "select datname from pg_database where datname != 'template0'" | while read a; do echo "check for ${a}";psql -Atc " select 'drop schema if exists ' || nspname || ' cascade;' from (select nspname from gp_dist_random('pg_namespace') where nspname like 'pg_temp%' except select 'pg_temp_' || sess_id::varchar from pg_stat_activity) as foo;" ${a}; done
vincentsun85 2019-12-02 01:50:49 0 浏览量 回答数 0

回答

简介:这是MySQL中的一个已知问题,已在MySQL 5.6.x中修复。问题是由于使用IN的子查询被错误地标识为从属子查询而不是独立子查询时缺少优化。 在原始查询上运行EXPLAIN时,它将返回以下内容: 1'PRIMARY''question_law_version''ALL'''''''''10148'在哪里使用' 2'DEPENDENT SUBQUERY''question_law_version''ALL'''''''''10148'在哪里使用' 3'DEPENDENT SUBQUERY''question_law''ALL'''''''''10040'在哪里使用' 当您更改IN为=以下内容时: 1'PRIMARY''question_law_version''ALL'''''''''10148'在哪里使用' 2'SUBQUERY''question_law_version''ALL'''''''''10148'在哪里使用' 3'SUBQUERY''question_law''ALL'''''''''''10040'在哪里使用' 每个相关子查询在包含该查询的查询中每行运行一次,而子查询仅运行一次。当存在可以转换为联接的条件时,MySQL有时可以优化依赖的子查询,但事实并非如此。 现在,这当然留下了一个问题,为什么MySQL认为IN版本需要是一个依赖的子查询。我做了查询的简化版本,以帮助调查此。我创建了两个表“ foo”和“ bar”,其中前者仅包含一个id列,而后者同时包含一个id和一个foo id(尽管我没有创建外键约束)。然后我用1000行填充了两个表: CREATE TABLE foo (id INT PRIMARY KEY NOT NULL); CREATE TABLE bar (id INT PRIMARY KEY, foo_id INT NOT NULL); -- populate tables with 1000 rows in each SELECT id FROM foo WHERE id IN ( SELECT MAX(foo_id) FROM bar ); 这种简化的查询与以前存在相同的问题-内部选择被视为从属子查询,并且不执行优化,从而导致内部查询每行运行一次。该查询将花费几乎一秒钟的时间来运行。将再次更改IN为=可以使查询几乎立即运行。 下面是我用来填充表格的代码,以防万一有人希望重现结果。 CREATE TABLE filler ( id INT NOT NULL PRIMARY KEY AUTO_INCREMENT ) ENGINE=Memory; DELIMITER $$ CREATE PROCEDURE prc_filler(cnt INT) BEGIN DECLARE _cnt INT; SET _cnt = 1; WHILE _cnt <= cnt DO INSERT INTO filler SELECT _cnt; SET _cnt = _cnt + 1; END WHILE; END $$ DELIMITER ; CALL prc_filler(1000); INSERT foo SELECT id FROM filler; INSERT bar SELECT id, id FROM filler;来源:stack overflow
保持可爱mmm 2020-05-10 20:55:15 0 浏览量 回答数 0

回答

尽量避免使用全局变量。 使用参数将对象传递给函数有一种规范的方法可以将值传递给函数:arguments。 调用包装器时,将对象作为参数传递给修饰函数。 from functools import wraps def decorator(f): obj = 1 @wraps(f) def wrapper(*args): return f(obj, *args) return wrapper @decoratordef func(x) print(x) func() # prints 1使用默认参数传递同一对象如果需要将相同的对象传递给所有函数,则将其存储为装饰器的默认参数是另一种选择。 from functools import wraps def decorator(f, obj={}): @wraps(f) def wrapper(*args): return f(obj, *args) return wrapper @decoratordef func(params) params['foo'] = True @decoratordef gunc(params) print(params) func() proof that gunc receives the same object gunc() # prints {'foo': True}上面创建了一个公共私有dict,只能通过修饰函数访问。由于a dict是可变的,因此更改将反映在函数调用之间。 def declare_view(**kwds): """declaratively assocatiate a Django View function with resources """ def actual_decorator(func): for k, v in kwds.items(): setattr(func, k, v) return func return actual_decorator 调用装饰器@declare_view( x=2 )def decorated_func(): #the function can look at its own name, because the function exists #by the time it gets called. print("x in decorated_func:", decorated_func.x) decorated_func()产出x in decorated_func: 2 在实践中,我已经使用了相当多的东西。我的想法是将Django视图函数与他们必须协作的特定后端数据类和模板相关联。因为它是声明性的,所以我可以通过所有Django视图进行内省并跟踪它们的相关URL以及自定义数据对象和模板。效果非常好,但是,该函数确实希望某些属性本身存在。它不知道装饰者设置它们。 哦,并且没有充分的理由,在我的情况下,这些变量在我的用例中作为参数传递,这些变量基本上保持硬编码值,这些值永远不会从函数的POV中改变。 一开始很奇怪,但非常强大,没有运行或维护缺点。 这是一些将其置于上下文中的实例。 @declare_view( viewmanager_cls=backend.VueManagerDetailPSCLASSDEFN, template_name="pssecurity/detail.html", objecttype=constants.OBJECTTYPE_PERMISSION_LIST[0], bundle_name="pssecurity/detail.psclassdefn", )def psclassdefn_detail(request, CLASSID, dbr=None, PORTAL_NAME="EMPLOYEE"): """ """ f_view = psclassdefn_detail viewmanager = f_view.viewmanager_cls(request, mdb, f_view=f_view) ...do things based on the parameters... return viewmanager.HttpResponse(f_view.template_name)
一码平川MACHEL 2019-12-02 01:54:26 0 浏览量 回答数 0

问题

linux 简单makefile,foo=sort,在sort的函数中以$(foo)引用会失败?

line 8里面以$(func)引用sort函数,没效果,直接以sort替换$(func),是OK,什么情况?makefile 1 do_sort= 2 ifdef do_sort 3 func=strip 4 else 5 func=so...
云栖技术 2019-12-01 19:43:59 1023 浏览量 回答数 1

问题

apache报错therequestedoperationhasfailed

安装apache后 重启服务器就提示the requested operation has failed 检查过80端口没被占用 用命令: httpd.exe -w -n "Apache2" -k star...
失望 2019-12-01 21:00:00 14097 浏览量 回答数 2

回答

回1楼梦丫头的帖子 apache  弄了一天了  没弄明白,各种问题....................才想换 不知道那个好! ------------------------- 回3楼梦丫头的帖子 配置好后,访问很慢,很慢,导致打不开,不知道什么问题, 以下是配置文件 # # 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.4/> for detailed information. # In particular, see # <URL:http://httpd.apache.org/docs/2.4/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/access_log" # with ServerRoot set to "/usr/local/apache2" will be interpreted by the # server as "/usr/local/apache2/logs/access_log", whereas "/logs/access_log" # will be interpreted as '/logs/access_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 specify a local disk on the # Mutex directive, if file-based mutexes are used.  If you wish to share the # same ServerRoot for multiple httpd daemons, you will need to change at # least PidFile. # Define SRVROOT "/Apache24" ServerRoot "D:/HJ/Apache24" # # Mutex: Allows you to set the mutex mechanism and mutex file directory # for individual mutexes, or change the global defaults # # Uncomment and change the directory if mutexes are file-based and the default # mutex file directory is not on a local disk or is not appropriate for some # other reason. # # Mutex default:logs # # 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 access_compat_module modules/mod_access_compat.so LoadModule actions_module modules/mod_actions.so LoadModule alias_module modules/mod_alias.so LoadModule allowmethods_module modules/mod_allowmethods.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 auth_form_module modules/mod_auth_form.so #LoadModule authn_anon_module modules/mod_authn_anon.so LoadModule authn_core_module modules/mod_authn_core.so #LoadModule authn_dbd_module modules/mod_authn_dbd.so #LoadModule authn_dbm_module modules/mod_authn_dbm.so LoadModule authn_file_module modules/mod_authn_file.so #LoadModule authn_socache_module modules/mod_authn_socache.so #LoadModule authnz_fcgi_module modules/mod_authnz_fcgi.so #LoadModule authnz_ldap_module modules/mod_authnz_ldap.so LoadModule authz_core_module modules/mod_authz_core.so #LoadModule authz_dbd_module modules/mod_authz_dbd.so #LoadModule authz_dbm_module modules/mod_authz_dbm.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 buffer_module modules/mod_buffer.so #LoadModule cache_module modules/mod_cache.so #LoadModule cache_disk_module modules/mod_cache_disk.so #LoadModule cache_socache_module modules/mod_cache_socache.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 data_module modules/mod_data.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 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 heartbeat_module modules/mod_heartbeat.so #LoadModule heartmonitor_module modules/mod_heartmonitor.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 lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so #LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so #LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so #LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.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_debug_module modules/mod_log_debug.so #LoadModule log_forensic_module modules/mod_log_forensic.so #LoadModule lua_module modules/mod_lua.so #LoadModule macro_module modules/mod_macro.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_express_module modules/mod_proxy_express.so #LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so #LoadModule proxy_ftp_module modules/mod_proxy_ftp.so #LoadModule proxy_html_module modules/mod_proxy_html.so #LoadModule proxy_http_module modules/mod_proxy_http.so #LoadModule proxy_scgi_module modules/mod_proxy_scgi.so #LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so #LoadModule ratelimit_module modules/mod_ratelimit.so #LoadModule reflector_module modules/mod_reflector.so #LoadModule remoteip_module modules/mod_remoteip.so #LoadModule request_module modules/mod_request.so #LoadModule reqtimeout_module modules/mod_reqtimeout.so #LoadModule rewrite_module modules/mod_rewrite.so #LoadModule sed_module modules/mod_sed.so #LoadModule session_module modules/mod_session.so #LoadModule session_cookie_module modules/mod_session_cookie.so #LoadModule session_crypto_module modules/mod_session_crypto.so #LoadModule session_dbd_module modules/mod_session_dbd.so LoadModule setenvif_module modules/mod_setenvif.so #LoadModule slotmem_plain_module modules/mod_slotmem_plain.so #LoadModule slotmem_shm_module modules/mod_slotmem_shm.so #LoadModule socache_dbm_module modules/mod_socache_dbm.so #LoadModule socache_memcache_module modules/mod_socache_memcache.so LoadModule socache_shmcb_module modules/mod_socache_shmcb.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 #LoadModule watchdog_module modules/mod_watchdog.so #LoadModule xml2enc_module modules/mod_xml2enc.so <IfModule unixd_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> # '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 admin@example.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 localhost:80 # # Deny access to the entirety of your server's filesystem. You must # explicitly permit access to web content directories in other # <Directory> blocks below. # <Directory />     AllowOverride none     Require all denied </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. # # # 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:/wed" <Directory "d:/wed">     #     # 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.4/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 FileInfo     #     # Controls who can get stuff from this server.     #     Require all granted </Directory> # # DirectoryIndex: sets the file that Apache will serve if a directory # is requested. # <IfModule dir_module>     DirectoryIndex index.php index.htm index.html </IfModule> # # The following lines prevent .htaccess and .htpasswd files from being # viewed by Web clients. # <Files ".ht*">     Require all denied </Files> # # 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.example.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:/Apache24/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> # # "${SRVROOT}/cgi-bin" should be changed to whatever your ScriptAliased # CGI directory exists, if you have that configured. # <Directory "d:/HJ/Apache24/cgi-bin">     AllowOverride None     Options None     Require all granted </Directory> <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 .pl     # 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.example.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 may be 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. # Defaults: EnableMMAP On, EnableSendfile Off # #EnableMMAP off #EnableSendfile on #AcceptFilter http none #AcceptFilter https none # 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 # Configure mod_proxy_html to understand HTML4/XHTML1 <IfModule proxy_html_module> Include conf/extra/httpd-proxy-html.conf </IfModule> # Secure (SSL/TLS) connections # 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> #Include conf/extra/httpd-ssl.conf Include conf/extra/httpd-ahssl.conf SSLRandomSeed startup builtin SSLRandomSeed connect builtin </IfModule> LoadModule php5_module "d:/HJ/php/php5apache2_4.dll" AddHandler application/x-httpd-php .php PHPIniDir "d:/HJ/php" ------------------------- 回5楼梦丫头的帖子 这个是apache的配置文件 httpd.conf
失望 2019-12-02 03:07:31 0 浏览量 回答数 0

回答

Relocalhost和127.0.0.1都无法正常访问 引用第2楼dongshan8于2016-04-19 10:05发表的  : 楼主您好, 能贴出您的 apache 配置文件内容吗? 您是如何布置的 apache + php + mysql 的呢?是手工安装,还是用自动安装脚本来安装的? ....... [url=https://bbs.aliyun.com/job.php?action=topost&tid=277757&pid=779671][/url] 版主来了, 太感动了, 多谢!!!    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:/WAMP/apache" will be interpreted by the# server as "D:/WAMP/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:/WAMP/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:80Listen 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.soLoadModule alias_module modules/mod_alias.soLoadModule asis_module modules/mod_asis.soLoadModule 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.soLoadModule authn_default_module modules/mod_authn_default.soLoadModule 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.soLoadModule authz_default_module modules/mod_authz_default.soLoadModule authz_groupfile_module modules/mod_authz_groupfile.soLoadModule authz_host_module modules/mod_authz_host.so#LoadModule authz_owner_module modules/mod_authz_owner.soLoadModule authz_user_module modules/mod_authz_user.soLoadModule autoindex_module modules/mod_autoindex.so#LoadModule cache_module modules/mod_cache.so#LoadModule cern_meta_module modules/mod_cern_meta.soLoadModule 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.soLoadModule deflate_module modules/mod_deflate.soLoadModule dir_module modules/mod_dir.so#LoadModule disk_cache_module modules/mod_disk_cache.so#LoadModule dumpio_module modules/mod_dumpio.soLoadModule env_module modules/mod_env.soLoadModule expires_module modules/mod_expires.so#LoadModule ext_filter_module modules/mod_ext_filter.so#LoadModule file_cache_module modules/mod_file_cache.soLoadModule filter_module modules/mod_filter.soLoadModule headers_module modules/mod_headers.so#LoadModule ident_module modules/mod_ident.so#LoadModule imagemap_module modules/mod_imagemap.soLoadModule include_module modules/mod_include.so#LoadModule info_module modules/mod_info.soLoadModule isapi_module modules/mod_isapi.so#LoadModule ldap_module modules/mod_ldap.so#LoadModule logio_module modules/mod_logio.soLoadModule 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.soLoadModule mime_module modules/mod_mime.so#LoadModule mime_magic_module modules/mod_mime_magic.soLoadModule 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.soLoadModule rewrite_module modules/mod_rewrite.soLoadModule setenvif_module modules/mod_setenvif.so#LoadModule speling_module modules/mod_speling.soLoadModule 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<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 daemonGroup 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 scp1688@163.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.phpStudy.net: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:\WAMP\WWW"## 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 All    Order deny,allow    Allow 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:\WAMP\WWW">    #    # 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 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 All    #    # 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 index.php index.htm</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.phpStudy.net/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:/WAMP/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:/WAMP/apache/cgi-bin" should be changed to whatever your ScriptAliased# CGI directory exists, if you have that configured.#<Directory "D:/WAMP/apache/cgi-bin">    AllowOverride All    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.phpStudy.net/subscription_info.html### MaxRanges: Maximum number of Ranges in a request before# returning the entire resource, or 0 for unlimited# Default setting is to accept 200 Ranges#MaxRanges 0## 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 hostsInclude 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.confInclude conf/phpmyadmin.confInclude conf/vhosts.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.#LoadFile "D:/WAMP/PHP/php5ts.dll"LoadModule php5_module "D:/WAMP/PHP/php5apache2_2.dll"<IfModule php5_module>    PHPIniDir "D:/WAMP/PHP/"    AddType application/x-httpd-php .php .phtml</IfModule>LoadFile "D:/WAMP/PHP/libmysql.dll"LoadFile "D:/WAMP/PHP/libmcrypt.dll"<IfModule ssl_module>SSLRandomSeed startup builtinSSLRandomSeed connect builtin</IfModule><IfModule mod_Rewrite.c>RewriteEngine OnRewriteRule ^(.*)/archiver/((fid|tid)-[\w\-]+\.html)$ $1/archiver/index.php?$2RewriteRule ^(.*)/forum-([0-9]+)-([0-9]+)\.html$ $1/forumdisplay.php?fid=$2&page=$3RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/viewthread.php?tid=$2&extra=page\%3D$4&page=$3RewriteRule ^(.*)/space-(username|uid)-(.+)\.html$ $1/space.php?$2=$3RewriteRule ^(.*)/tag-(.+)\.html$ $1/tag.php?name=$2</IfModule><ifmodule mod_deflate.c>AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/x-javascript application/javascript</ifmodule>TraceEnable off<IfModule deflate_module>SetOutputFilter DEFLATE# Don’t compress images and otherSetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-varySetEnvIfNoCase Request_URI .(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-varySetEnvIfNoCase Request_URI .(?:pdf|doc)$ no-gzip dont-varyAddOutputFilterByType DEFLATE text/html text/plain text/xml text/cssAddOutputFilterByType DEFLATE application/x-javascript</IfModule> ------------------------- Relocalhost和127.0.0.1都无法正常访问 哦, 我找到了, 默认目录修改之后这里没有跟上, 感谢版主的帮助, 谢谢!
tunawt 2019-12-02 02:35:55 0 浏览量 回答数 0

回答

可能有两个主要区别: Ruby具有优雅的匿名闭包。 Rails使用它们效果很好。这是一个例子: class WeblogController < ActionController::Base def index @posts = Post.find :all respond_to do |format| format.html format.xml { render :xml => @posts.to_xml } format.rss { render :action => "feed.rxml" } end end end 匿名闭包/ lambda使模拟可能会阻塞的新语言功能更加容易。在Python中,存在闭包,但是必须对其进行命名才能使用。因此,您不能使用闭包来模仿新的语言功能,而必须明确说明使用闭包的事实。 Ruby具有更干净,更易于使用的元编程。 这在Rails中得到了广泛的使用,主要是因为它易于使用。具体来说,在Ruby中,您可以在类的上下文中执行任意代码。以下片段是等效的: class Foo def self.make_hello_method class_eval do def hello puts "HELLO" end end end end class Bar < Foo # snippet 1 make_hello_method end class Bar < Foo; end # snippet 2 Bar.make_hello_method 在这两种情况下,您都可以执行以下操作: Bar.new.hello 它将打印“ HELLO”。该class_eval方法还带有一个String,因此可以在创建类时动态创建方法,这些方法基于传入的参数具有不同的语义。 实际上,可以用Python(以及其他语言)进行这种元编程,但是Ruby有优势,因为元编程不是一种特殊的编程风格。它源于以下事实:在Ruby中,一切都是对象,并且所有代码行都直接执行。结果,Classes本身就是对象,类主体self指向Class,并且您可以在创建类时在类上调用方法。 这在很大程度上要归因于Rails中可能的声明性程度,以及我们能够轻松实现看起来像关键字或新的块语言功能的新声明性功能的原因。
祖安文状元 2020-02-22 15:48:56 0 浏览量 回答数 0

回答

回 1楼dongshan8的帖子 Apache我重装成2.4的版本  这个问题已经没有了    但是现在配置好以后用https访问却显示"此网站无法提供安全连接"  "使用了不受支持的协议" "ERR_SSL_VERSION_OR_CIPHER_MISMATCH"        安全组配置了443端口     ------------------------- 回 3楼dongshan8的帖子 现在只能通过SSL2.0访问       但是配置里面协议我已经这 样子设置了"SSLProtocol all -SSLv2 -SSLv3"       怎么改都没效果      是一直使用的SSL2.0 ------------------------- 回 6楼dongshan8的帖子 openssl的版本是1.0.1u   我在服务器上wget了一下https的地址   结果显示 sslv3 alert handshake failure   用openssl s_client -connect 测试了一下地址     怎么最后说Verify return code: 20 (unable to get local issuer certificate) ------------------------- Re回 8楼dongshan8的帖子 # # This is the main Apache HTTP server configuration file.  It contains the # configuration directives that give the server its instructions. # In particular, see # 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/access_log" # with ServerRoot set to "/usr/local/apache2" will be interpreted by the # server as "/usr/local/apache2/logs/access_log", whereas "/logs/access_log" # will be interpreted as '/logs/access_log'. # # 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 specify a local disk on the # Mutex directive, if file-based mutexes are used.  If you wish to share the # same ServerRoot for multiple httpd daemons, you will need to change at # least PidFile. # ServerRoot "/usr/local/http-2.4.23" # # Mutex: Allows you to set the mutex mechanism and mutex file directory # for individual mutexes, or change the global defaults # # Uncomment and change the directory if mutexes are file-based and the default # mutex file directory is not on a local disk or is not appropriate for some # other reason. # # Mutex default:logs # # 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 authn_file_module modules/mod_authn_file.so #LoadModule authn_dbm_module modules/mod_authn_dbm.so #LoadModule authn_anon_module modules/mod_authn_anon.so #LoadModule authn_dbd_module modules/mod_authn_dbd.so #LoadModule authn_socache_module modules/mod_authn_socache.so LoadModule authn_core_module modules/mod_authn_core.so LoadModule authz_host_module modules/mod_authz_host.so LoadModule authz_groupfile_module modules/mod_authz_groupfile.so LoadModule authz_user_module modules/mod_authz_user.so #LoadModule authz_dbm_module modules/mod_authz_dbm.so #LoadModule authz_owner_module modules/mod_authz_owner.so #LoadModule authz_dbd_module modules/mod_authz_dbd.so LoadModule authz_core_module modules/mod_authz_core.so LoadModule access_compat_module modules/mod_access_compat.so LoadModule auth_basic_module modules/mod_auth_basic.so #LoadModule auth_form_module modules/mod_auth_form.so #LoadModule auth_digest_module modules/mod_auth_digest.so #LoadModule allowmethods_module modules/mod_allowmethods.so #LoadModule file_cache_module modules/mod_file_cache.so #LoadModule cache_module modules/mod_cache.so #LoadModule cache_disk_module modules/mod_cache_disk.so #LoadModule cache_socache_module modules/mod_cache_socache.so LoadModule socache_shmcb_module modules/mod_socache_shmcb.so #LoadModule socache_dbm_module modules/mod_socache_dbm.so #LoadModule socache_memcache_module modules/mod_socache_memcache.so #LoadModule watchdog_module modules/mod_watchdog.so #LoadModule macro_module modules/mod_macro.so #LoadModule dbd_module modules/mod_dbd.so #LoadModule dumpio_module modules/mod_dumpio.so #LoadModule buffer_module modules/mod_buffer.so #LoadModule ratelimit_module modules/mod_ratelimit.so LoadModule reqtimeout_module modules/mod_reqtimeout.so #LoadModule ext_filter_module modules/mod_ext_filter.so #LoadModule request_module modules/mod_request.so #LoadModule include_module modules/mod_include.so LoadModule filter_module modules/mod_filter.so #LoadModule substitute_module modules/mod_substitute.so #LoadModule sed_module modules/mod_sed.so #LoadModule deflate_module modules/mod_deflate.so LoadModule mime_module modules/mod_mime.so LoadModule log_config_module modules/mod_log_config.so #LoadModule log_debug_module modules/mod_log_debug.so #LoadModule logio_module modules/mod_logio.so LoadModule env_module modules/mod_env.so #LoadModule expires_module modules/mod_expires.so LoadModule headers_module modules/mod_headers.so #LoadModule unique_id_module modules/mod_unique_id.so LoadModule setenvif_module modules/mod_setenvif.so LoadModule version_module modules/mod_version.so #LoadModule remoteip_module modules/mod_remoteip.so #LoadModule proxy_module modules/mod_proxy.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_fcgi_module modules/mod_proxy_fcgi.so #LoadModule proxy_scgi_module modules/mod_proxy_scgi.so #LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so #LoadModule proxy_ajp_module modules/mod_proxy_ajp.so #LoadModule proxy_balancer_module modules/mod_proxy_balancer.so #LoadModule proxy_express_module modules/mod_proxy_express.so #LoadModule proxy_hcheck_module modules/mod_proxy_hcheck.so #LoadModule session_module modules/mod_session.so #LoadModule session_cookie_module modules/mod_session_cookie.so #LoadModule session_dbd_module modules/mod_session_dbd.so #LoadModule slotmem_shm_module modules/mod_slotmem_shm.so LoadModule ssl_module modules/mod_ssl.so #LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so #LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so #LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so #LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so LoadModule mpm_event_module modules/mod_mpm_event.so #LoadModule mpm_prefork_module modules/mod_mpm_prefork.so #LoadModule mpm_worker_module modules/mod_mpm_worker.so LoadModule unixd_module modules/mod_unixd.so #LoadModule dav_module modules/mod_dav.so LoadModule status_module modules/mod_status.so LoadModule autoindex_module modules/mod_autoindex.so #LoadModule info_module modules/mod_info.so <IfModule !mpm_prefork_module>     #LoadModule cgid_module modules/mod_cgid.so </IfModule> <IfModule mpm_prefork_module>     #LoadModule cgi_module modules/mod_cgi.so </IfModule> #LoadModule dav_fs_module modules/mod_dav_fs.so #LoadModule vhost_alias_module modules/mod_vhost_alias.so #LoadModule negotiation_module modules/mod_negotiation.so LoadModule dir_module modules/mod_dir.so #LoadModule actions_module modules/mod_actions.so #LoadModule speling_module modules/mod_speling.so #LoadModule userdir_module modules/mod_userdir.so LoadModule alias_module modules/mod_alias.so LoadModule rewrite_module modules/mod_rewrite.so LoadModule php5_module        modules/libphp5.so <IfModule unixd_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> # '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 root@localhost # # 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 localhost # # Deny access to the entirety of your server's filesystem. You must # explicitly permit access to web content directories in other # <Directory> blocks below. # <Directory />     AllowOverride All     Require all denied </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. # # # 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 "/var/www/" <Directory "/var/www/">     #     # 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     # 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:     #   AllowOverride FileInfo AuthConfig Limit     #     AllowOverride All     #     # Controls who can get stuff from this server.     #     Require all granted </Directory> # # DirectoryIndex: sets the file that Apache will serve if a directory # is requested. # <IfModule dir_module>     DirectoryIndex index.html index.php </IfModule> # # The following lines prevent .htaccess and .htpasswd files from being # viewed by Web clients. # <Files ".ht*">     Require all denied </Files> # # 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.example.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/ "/usr/local/http-2.4.23/cgi-bin/" </IfModule> <IfModule mod_php5.c>     AddType application/x-httpd-php .php     AddType application/x-httpd-php .php5     AddType application/x-httpd-php-source .phps     AddType application/x-httpd-php-source .php5s     DirectoryIndex index.php     DirectoryIndex index.php5     PHPIniDir "/usr/local/php/etc/" </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 cgisock </IfModule> # # "/usr/local/http-2.4.23/cgi-bin" should be changed to whatever your ScriptAliased # CGI directory exists, if you have that configured. # <Directory "/usr/local/http-2.4.23/cgi-bin">     AllowOverride None     Options None     Require all granted </Directory> <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" # # # 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 may be 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. # Defaults: EnableMMAP On, EnableSendfile Off # #EnableMMAP off #EnableSendfile on # 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 # Configure mod_proxy_html to understand HTML4/XHTML1 <IfModule proxy_html_module> Include conf/extra/proxy-html.conf </IfModule> # 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> ------------------------- Re回 8楼dongshan8的帖子 # Virtual Hosts # # Required modules: mod_log_config # 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.4/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. # # 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 www.qipaifan.com DocumentRoot " ServerName www.qipaifan.com <Directory /> AllowOverride All Require all granted </Directory> </VirtualHost> <VirtualHost *:80> ServerAdmin bbs.qipaifan.com DocumentRoot "/ ServerName bbs.qipaifan.com <Directory /> AllowOverride all Require all granted </Directory> </VirtualHost> ------------------------- Re回 8楼dongshan8的帖子 ssl配置文件发不上来      发图片吧        我没发现有什么异常啊...
淘乐网络 2019-12-02 00:26:29 0 浏览量 回答数 0

回答

回 1楼dongshan8的帖子 Apache我重装成2.4的版本  这个问题已经没有了    但是现在配置好以后用https访问却显示"此网站无法提供安全连接"  "使用了不受支持的协议" "ERR_SSL_VERSION_OR_CIPHER_MISMATCH"        安全组配置了443端口     ------------------------- 回 3楼dongshan8的帖子 现在只能通过SSL2.0访问       但是配置里面协议我已经这 样子设置了"SSLProtocol all -SSLv2 -SSLv3"       怎么改都没效果      是一直使用的SSL2.0 ------------------------- 回 6楼dongshan8的帖子 openssl的版本是1.0.1u   我在服务器上wget了一下https的地址   结果显示 sslv3 alert handshake failure   用openssl s_client -connect 测试了一下地址     怎么最后说Verify return code: 20 (unable to get local issuer certificate) ------------------------- Re回 8楼dongshan8的帖子 # # This is the main Apache HTTP server configuration file.  It contains the # configuration directives that give the server its instructions. # In particular, see # 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/access_log" # with ServerRoot set to "/usr/local/apache2" will be interpreted by the # server as "/usr/local/apache2/logs/access_log", whereas "/logs/access_log" # will be interpreted as '/logs/access_log'. # # 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 specify a local disk on the # Mutex directive, if file-based mutexes are used.  If you wish to share the # same ServerRoot for multiple httpd daemons, you will need to change at # least PidFile. # ServerRoot "/usr/local/http-2.4.23" # # Mutex: Allows you to set the mutex mechanism and mutex file directory # for individual mutexes, or change the global defaults # # Uncomment and change the directory if mutexes are file-based and the default # mutex file directory is not on a local disk or is not appropriate for some # other reason. # # Mutex default:logs # # 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 authn_file_module modules/mod_authn_file.so #LoadModule authn_dbm_module modules/mod_authn_dbm.so #LoadModule authn_anon_module modules/mod_authn_anon.so #LoadModule authn_dbd_module modules/mod_authn_dbd.so #LoadModule authn_socache_module modules/mod_authn_socache.so LoadModule authn_core_module modules/mod_authn_core.so LoadModule authz_host_module modules/mod_authz_host.so LoadModule authz_groupfile_module modules/mod_authz_groupfile.so LoadModule authz_user_module modules/mod_authz_user.so #LoadModule authz_dbm_module modules/mod_authz_dbm.so #LoadModule authz_owner_module modules/mod_authz_owner.so #LoadModule authz_dbd_module modules/mod_authz_dbd.so LoadModule authz_core_module modules/mod_authz_core.so LoadModule access_compat_module modules/mod_access_compat.so LoadModule auth_basic_module modules/mod_auth_basic.so #LoadModule auth_form_module modules/mod_auth_form.so #LoadModule auth_digest_module modules/mod_auth_digest.so #LoadModule allowmethods_module modules/mod_allowmethods.so #LoadModule file_cache_module modules/mod_file_cache.so #LoadModule cache_module modules/mod_cache.so #LoadModule cache_disk_module modules/mod_cache_disk.so #LoadModule cache_socache_module modules/mod_cache_socache.so LoadModule socache_shmcb_module modules/mod_socache_shmcb.so #LoadModule socache_dbm_module modules/mod_socache_dbm.so #LoadModule socache_memcache_module modules/mod_socache_memcache.so #LoadModule watchdog_module modules/mod_watchdog.so #LoadModule macro_module modules/mod_macro.so #LoadModule dbd_module modules/mod_dbd.so #LoadModule dumpio_module modules/mod_dumpio.so #LoadModule buffer_module modules/mod_buffer.so #LoadModule ratelimit_module modules/mod_ratelimit.so LoadModule reqtimeout_module modules/mod_reqtimeout.so #LoadModule ext_filter_module modules/mod_ext_filter.so #LoadModule request_module modules/mod_request.so #LoadModule include_module modules/mod_include.so LoadModule filter_module modules/mod_filter.so #LoadModule substitute_module modules/mod_substitute.so #LoadModule sed_module modules/mod_sed.so #LoadModule deflate_module modules/mod_deflate.so LoadModule mime_module modules/mod_mime.so LoadModule log_config_module modules/mod_log_config.so #LoadModule log_debug_module modules/mod_log_debug.so #LoadModule logio_module modules/mod_logio.so LoadModule env_module modules/mod_env.so #LoadModule expires_module modules/mod_expires.so LoadModule headers_module modules/mod_headers.so #LoadModule unique_id_module modules/mod_unique_id.so LoadModule setenvif_module modules/mod_setenvif.so LoadModule version_module modules/mod_version.so #LoadModule remoteip_module modules/mod_remoteip.so #LoadModule proxy_module modules/mod_proxy.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_fcgi_module modules/mod_proxy_fcgi.so #LoadModule proxy_scgi_module modules/mod_proxy_scgi.so #LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so #LoadModule proxy_ajp_module modules/mod_proxy_ajp.so #LoadModule proxy_balancer_module modules/mod_proxy_balancer.so #LoadModule proxy_express_module modules/mod_proxy_express.so #LoadModule proxy_hcheck_module modules/mod_proxy_hcheck.so #LoadModule session_module modules/mod_session.so #LoadModule session_cookie_module modules/mod_session_cookie.so #LoadModule session_dbd_module modules/mod_session_dbd.so #LoadModule slotmem_shm_module modules/mod_slotmem_shm.so LoadModule ssl_module modules/mod_ssl.so #LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so #LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so #LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so #LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so LoadModule mpm_event_module modules/mod_mpm_event.so #LoadModule mpm_prefork_module modules/mod_mpm_prefork.so #LoadModule mpm_worker_module modules/mod_mpm_worker.so LoadModule unixd_module modules/mod_unixd.so #LoadModule dav_module modules/mod_dav.so LoadModule status_module modules/mod_status.so LoadModule autoindex_module modules/mod_autoindex.so #LoadModule info_module modules/mod_info.so <IfModule !mpm_prefork_module>     #LoadModule cgid_module modules/mod_cgid.so </IfModule> <IfModule mpm_prefork_module>     #LoadModule cgi_module modules/mod_cgi.so </IfModule> #LoadModule dav_fs_module modules/mod_dav_fs.so #LoadModule vhost_alias_module modules/mod_vhost_alias.so #LoadModule negotiation_module modules/mod_negotiation.so LoadModule dir_module modules/mod_dir.so #LoadModule actions_module modules/mod_actions.so #LoadModule speling_module modules/mod_speling.so #LoadModule userdir_module modules/mod_userdir.so LoadModule alias_module modules/mod_alias.so LoadModule rewrite_module modules/mod_rewrite.so LoadModule php5_module        modules/libphp5.so <IfModule unixd_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> # '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 root@localhost # # 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 localhost # # Deny access to the entirety of your server's filesystem. You must # explicitly permit access to web content directories in other # <Directory> blocks below. # <Directory />     AllowOverride All     Require all denied </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. # # # 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 "/var/www/" <Directory "/var/www/">     #     # 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     # 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:     #   AllowOverride FileInfo AuthConfig Limit     #     AllowOverride All     #     # Controls who can get stuff from this server.     #     Require all granted </Directory> # # DirectoryIndex: sets the file that Apache will serve if a directory # is requested. # <IfModule dir_module>     DirectoryIndex index.html index.php </IfModule> # # The following lines prevent .htaccess and .htpasswd files from being # viewed by Web clients. # <Files ".ht*">     Require all denied </Files> # # 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.example.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/ "/usr/local/http-2.4.23/cgi-bin/" </IfModule> <IfModule mod_php5.c>     AddType application/x-httpd-php .php     AddType application/x-httpd-php .php5     AddType application/x-httpd-php-source .phps     AddType application/x-httpd-php-source .php5s     DirectoryIndex index.php     DirectoryIndex index.php5     PHPIniDir "/usr/local/php/etc/" </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 cgisock </IfModule> # # "/usr/local/http-2.4.23/cgi-bin" should be changed to whatever your ScriptAliased # CGI directory exists, if you have that configured. # <Directory "/usr/local/http-2.4.23/cgi-bin">     AllowOverride None     Options None     Require all granted </Directory> <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" # # # 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 may be 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. # Defaults: EnableMMAP On, EnableSendfile Off # #EnableMMAP off #EnableSendfile on # 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 # Configure mod_proxy_html to understand HTML4/XHTML1 <IfModule proxy_html_module> Include conf/extra/proxy-html.conf </IfModule> # 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> ------------------------- Re回 8楼dongshan8的帖子 # Virtual Hosts # # Required modules: mod_log_config # 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.4/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. # # 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 www.qipaifan.com DocumentRoot " ServerName www.qipaifan.com <Directory /> AllowOverride All Require all granted </Directory> </VirtualHost> <VirtualHost *:80> ServerAdmin bbs.qipaifan.com DocumentRoot "/ ServerName bbs.qipaifan.com <Directory /> AllowOverride all Require all granted </Directory> </VirtualHost> ------------------------- Re回 8楼dongshan8的帖子 ssl配置文件发不上来      发图片吧        我没发现有什么异常啊...
淘乐网络 2019-12-02 00:26:30 0 浏览量 回答数 0

回答

line 8里面以$(func)引用sort函数,没效果,直接以sort替换$(func),是OK,什么情况? makefile 1 do_sort= 2 ifdef do_sort 3 func=strip 4 else 5 func=sort 6 endif 7 bar:=cd g p b a 8 foo=$($(func) $(bar)) 9 all: 10 @echo $(foo) 11 @echo $(sort $(bar)) make:
云栖技术 2019-12-02 02:35:27 0 浏览量 回答数 0

问题

修改了php.ini各种重启依旧无效:配置报错 

nginx, 再web页面输出phpinfo()如下所示,但是修改了php.ini后无论是重启nginx还是php-fpm配置文件都无效,希望大家帮帮忙 ubuntu系统,下图是我的配...
kun坤 2020-06-04 10:23:30 4 浏览量 回答数 1

回答

把配置贴全 <aclass="referer"target="_blank">@皮总 <preclass="brush:java;toolbar:true;auto-links:false;">##ThisisthemainApacheHTTPserverconfigurationfile.Itcontainsthe#configurationdirectivesthatgivetheserveritsinstructions.#See<URL:http://httpd.apache.org/docs/2.4/>fordetailedinformation.#Inparticular,see#<URL:http://httpd.apache.org/docs/2.4/mod/directives.html>#foradiscussionofeachconfigurationdirective.##DoNOTsimplyreadtheinstructionsinherewithoutunderstanding#whattheydo.They'rehereonlyashintsorreminders.Ifyouareunsure#consulttheonlinedocs.Youhavebeenwarned.##Configurationandlogfilenames:Ifthefilenamesyouspecifyformany#oftheserver'scontrolfilesbeginwith"/"(or"drive:/"forWin32),the#serverwillusethatexplicitpath.Ifthefilenamesdo notbegin#with"/",thevalueofServerRootisprepended--so"logs/access_log"#withServerRootsetto"/usr/local/apache2"willbeinterpretedbythe#serveras"/usr/local/apache2/logs/access_log",whereas"/logs/access_log"#willbeinterpretedas'/logs/access_log'.##ServerRoot:Thetopofthedirectorytreeunderwhichtheserver's#configuration,error,andlogfilesarekept.##Donotaddaslashattheendofthedirectorypath.Ifyoupoint#ServerRootatanon-localdisk,besuretospecifyalocaldiskonthe#Mutexdirective,iffile-basedmutexesareused.Ifyouwishtosharethe#sameServerRootformultiplehttpddaemons,youwillneedtochangeat#leastPidFile.#ServerRoot"/site01/program/apache"##Mutex:Allowsyoutosetthemutexmechanismandmutexfiledirectory#forindividualmutexes,orchangetheglobaldefaults##Uncommentandchangethedirectoryifmutexesarefile-basedandthedefault#mutexfiledirectoryisnotonalocaldiskorisnotappropriateforsome#otherreason.##Mutexdefault:logs##Listen:AllowsyoutobindApachetospecificIPaddressesand/or#ports,insteadofthedefault.Seealsothe<VirtualHost>#directive.##ChangethistoListenonspecificIPaddressesasshownbelowto#preventApachefromglommingontoallboundIPaddresses.##Listen12.34.56.78:80Listen80##DynamicSharedObject(DSO)Support##TobeabletousethefunctionalityofamodulewhichwasbuiltasaDSOyou#havetoplacecorresponding LoadModule'linesatthislocationsothe#directivescontainedinitareactuallyavailable_before_theyareused.#Staticallycompiledmodules(thoselistedbyhttpd-l')donotneed#tobeloadedhere.##Example:#LoadModulefoo_modulemodules/mod_foo.so#LoadModuleauthn_file_modulemodules/mod_authn_file.so#LoadModuleauthn_dbm_modulemodules/mod_authn_dbm.so#LoadModuleauthn_anon_modulemodules/mod_authn_anon.so#LoadModuleauthn_dbd_modulemodules/mod_authn_dbd.so#LoadModuleauthn_socache_modulemodules/mod_authn_socache.soLoadModuleauthn_core_modulemodules/mod_authn_core.soLoadModuleauthz_host_modulemodules/mod_authz_host.soLoadModuleauthz_groupfile_modulemodules/mod_authz_groupfile.soLoadModuleauthz_user_modulemodules/mod_authz_user.so#LoadModuleauthz_dbm_modulemodules/mod_authz_dbm.so#LoadModuleauthz_owner_modulemodules/mod_authz_owner.so#LoadModuleauthz_dbd_modulemodules/mod_authz_dbd.soLoadModuleauthz_core_modulemodules/mod_authz_core.soLoadModuleaccess_compat_modulemodules/mod_access_compat.soLoadModuleauth_basic_modulemodules/mod_auth_basic.so#LoadModuleauth_form_modulemodules/mod_auth_form.so#LoadModuleauth_digest_modulemodules/mod_auth_digest.so#LoadModuleallowmethods_modulemodules/mod_allowmethods.so#LoadModulefile_cache_modulemodules/mod_file_cache.so#LoadModulecache_modulemodules/mod_cache.so#LoadModulecache_disk_modulemodules/mod_cache_disk.so#LoadModulesocache_shmcb_modulemodules/mod_socache_shmcb.so#LoadModulesocache_dbm_modulemodules/mod_socache_dbm.so#LoadModulesocache_memcache_modulemodules/mod_socache_memcache.so#LoadModuledbd_modulemodules/mod_dbd.so#LoadModuledumpio_modulemodules/mod_dumpio.so#LoadModulebuffer_modulemodules/mod_buffer.so#LoadModuleratelimit_modulemodules/mod_ratelimit.soLoadModulereqtimeout_modulemodules/mod_reqtimeout.so#LoadModuleext_filter_modulemodules/mod_ext_filter.so#LoadModulerequest_modulemodules/mod_request.soLoadModuleinclude_modulemodules/mod_include.soLoadModulefilter_modulemodules/mod_filter.so#LoadModulesubstitute_modulemodules/mod_substitute.so#LoadModulesed_modulemodules/mod_sed.so#LoadModuledeflate_modulemodules/mod_deflate.soLoadModulemime_modulemodules/mod_mime.soLoadModulelog_config_modulemodules/mod_log_config.so#LoadModulelog_debug_modulemodules/mod_log_debug.so#LoadModulelogio_modulemodules/mod_logio.soLoadModuleenv_modulemodules/mod_env.so#LoadModuleexpires_modulemodules/mod_expires.soLoadModuleheaders_modulemodules/mod_headers.so#LoadModuleunique_id_modulemodules/mod_unique_id.soLoadModulesetenvif_modulemodules/mod_setenvif.soLoadModuleversion_modulemodules/mod_version.so#LoadModuleremoteip_modulemodules/mod_remoteip.so#LoadModuleproxy_modulemodules/mod_proxy.so#LoadModuleproxy_connect_modulemodules/mod_proxy_connect.so#LoadModuleproxy_ftp_modulemodules/mod_proxy_ftp.so#LoadModuleproxy_http_modulemodules/mod_proxy_http.so#LoadModuleproxy_fcgi_modulemodules/mod_proxy_fcgi.so#LoadModuleproxy_scgi_modulemodules/mod_proxy_scgi.so#LoadModuleproxy_ajp_modulemodules/mod_proxy_ajp.so#LoadModuleproxy_balancer_modulemodules/mod_proxy_balancer.so#LoadModuleproxy_express_modulemodules/mod_proxy_express.so#LoadModulesession_modulemodules/mod_session.so#LoadModulesession_cookie_modulemodules/mod_session_cookie.so#LoadModulesession_dbd_modulemodules/mod_session_dbd.so#LoadModuleslotmem_shm_modulemodules/mod_slotmem_shm.so#LoadModulessl_modulemodules/mod_ssl.so#LoadModulelbmethod_byrequests_modulemodules/mod_lbmethod_byrequests.so#LoadModulelbmethod_bytraffic_modulemodules/mod_lbmethod_bytraffic.so#LoadModulelbmethod_bybusyness_modulemodules/mod_lbmethod_bybusyness.so#LoadModulelbmethod_heartbeat_modulemodules/mod_lbmethod_heartbeat.soLoadModuleunixd_modulemodules/mod_unixd.so#LoadModuledav_modulemodules/mod_dav.soLoadModulestatus_modulemodules/mod_status.soLoadModuleautoindex_modulemodules/mod_autoindex.so#LoadModuleinfo_modulemodules/mod_info.so#LoadModulecgid_modulemodules/mod_cgid.so#LoadModuledav_fs_modulemodules/mod_dav_fs.so#LoadModulevhost_alias_modulemodules/mod_vhost_alias.so#LoadModulenegotiation_modulemodules/mod_negotiation.soLoadModuledir_modulemodules/mod_dir.so#LoadModuleactions_modulemodules/mod_actions.so#LoadModulespeling_modulemodules/mod_speling.so#LoadModuleuserdir_modulemodules/mod_userdir.soLoadModulealias_modulemodules/mod_alias.soLoadModulerewrite_modulemodules/mod_rewrite.so<IfModuleunixd_module>##Ifyouwishhttpdtorunasadifferentuserorgroup,youmustrun#httpdasrootinitiallyanditwillswitch.##User/Group:Thename(or#number)oftheuser/grouptorunhttpdas.#Itisusuallygoodpracticetocreateadedicateduserandgroupfor#runninghttpd,aswithmostsystemservices.#UserdaemonGroupdaemon</IfModule>#'Main'serverconfiguration##Thedirectivesinthissectionsetupthevaluesusedbythe'main'#server,whichrespondstoanyrequeststhataren'thandledbya#<VirtualHost>definition.Thesevaluesalsoprovidedefaultsfor#any<VirtualHost>containersyoumaydefinelaterinthefile.##Allofthesedirectivesmayappearinside<VirtualHost>containers,#inwhichcasethesedefaultsettingswillbeoverriddenforthe#virtualhostbeingdefined.###ServerAdmin:Youraddress,whereproblemswiththeservershouldbe#e-mailed.Thisaddressappearsonsomeserver-generatedpages,such#aserrordocuments.e.g.admin@your-domain.com#ServerAdminyou@example.com##ServerNamegivesthenameandportthattheserverusestoidentifyitself.#Thiscanoftenbedeterminedautomatically,butwerecommendyouspecify#itexplicitlytopreventproblemsduringstartup.##Ifyourhostdoesn'thavearegisteredDNSname,enteritsIPaddresshere.##ServerNamewww.example.com:80##Denyaccesstotheentiretyofyourserver'sfilesystem.Youmust#explicitlypermitaccesstowebcontentdirectoriesinother#<Directory>blocksbelow.#<Directory/>OptionsIndexesFollowSymLinksIncludesAllowOverrideNoneOrderallow,denyAllowfromallSatisfyall</Directory>##Notethatfromthispointforwardyoumustspecificallyallow#particularfeaturestobeenabled-soifsomething'snotworkingas#youmightexpect,makesurethatyouhavespecificallyenabledit#below.###DocumentRoot:Thedirectoryoutofwhichyouwillserveyour#documents.Bydefault,allrequestsaretakenfromthisdirectory,but#symboliclinksandaliasesmaybeusedtopointtootherlocations.#DocumentRoot"/site01/program/apache/htdocs"<Directory"/site01/program/apache/htdocs">##PossiblevaluesfortheOptionsdirectiveare"None","All",#oranycombinationof:#IndexesIncludesFollowSymLinksSymLinksifOwnerMatchExecCGIMultiViews##Notethat"MultiViews"mustbenamed explicitly---"OptionsAll"#doesn'tgiveittoyou.##TheOptionsdirectiveisbothcomplicatedandimportant.Pleasesee#http://httpd.apache.org/docs/2.4/mod/core.html#options#formoreinformation.#OptionsIndexesFollowSymLinks##AllowOverridecontrolswhatdirectivesmaybeplacedin.htaccessfiles.#Itcanbe"All","None",oranycombinationofthekeywords:#AllowOverrideFileInfoAuthConfigLimit#AllowOverrideNone##Controlswhocangetstufffromthisserver.#Requireallgranted</Directory>##DirectoryIndex:setsthefilethatApachewillserveifadirectory#isrequested.#<IfModuledir_module>DirectoryIndexindex.htmlindex.jsp</IfModule>##Thefollowinglinesprevent.htaccessand.htpasswdfilesfrombeing#viewedbyWebclients.#<Files".ht*">Requirealldenied</Files>##ErrorLog:Thelocationoftheerrorlogfile.#IfyoudonotspecifyanErrorLogdirectivewithina<VirtualHost>#container,errormessagesrelatingtothatvirtualhostwillbe#loggedhere.Ifyou dodefineanerrorlogfilefora<VirtualHost>#container,thathost'serrorswillbeloggedthereandnothere.#ErrorLog"logs/error_log"##LogLevel:Controlthenumberofmessagesloggedtotheerror_log.#Possiblevaluesinclude:debug,info,notice,warn,error,crit,#alert,emerg.#LogLevelwarn<IfModulelog_config_module>##Thefollowingdirectivesdefinesomeformatnicknamesforusewith#aCustomLogdirective(seebelow).#LogFormat"%h%l%u%t"%r"%>s%b"%{Referer}i""%{User-Agent}i""combinedLogFormat"%h%l%u%t"%r"%>s%b"common<IfModulelogio_module>#Youneedtoenablemod_logio.ctouse%Iand%OLogFormat"%h%l%u%t"%r"%>s%b"%{Referer}i""%{User-Agent}i"%I%O"combinedio</IfModule>##Thelocationandformatoftheaccesslogfile(CommonLogfileFormat).#Ifyoudonotdefineanyaccesslogfileswithina<VirtualHost>#container,theywillbeloggedhere.Contrariwise,ifyou do#defineper-<VirtualHost>accesslogfiles,transactionswillbe#loggedthereinand notinthisfile.#CustomLog"logs/access_log"common##Ifyoupreferalogfilewithaccess,agent,andrefererinformation#(CombinedLogfileFormat)youcanusethefollowingdirective.##CustomLog"logs/access_log"combined</IfModule><IfModulealias_module>##Redirect:Allowsyoutotellclientsaboutdocumentsthatusedto#existinyourserver'snamespace,butdonotanymore.Theclient#willmakeanewrequestforthedocumentatitsnewlocation.#Example:#Redirectpermanent/foohttp://www.example.com/bar##Alias:Mapswebpathsintofilesystempathsandisusedto#accesscontentthatdoesnotliveundertheDocumentRoot.#Example:#Alias/webpath/full/filesystem/path##Ifyouincludeatrailing/on/webpaththentheserverwill#requireittobepresentintheURL.Youwillalsolikely#needtoprovidea<Directory>sectiontoallowaccessto#thefilesystempath.##ScriptAlias:Thiscontrolswhichdirectoriescontainserverscripts.#ScriptAliasesareessentiallythesameasAliases,exceptthat#documentsinthetargetdirectoryaretreatedasapplicationsand#runbytheserverwhenrequestedratherthanasdocumentssenttothe#client.Thesamerulesabouttrailing"/"applytoScriptAlias#directivesastoAlias.#ScriptAlias/cgi-bin/"/site01/program/apache/cgi-bin/"</IfModule><IfModulecgid_module>##ScriptSock:Onthreadedservers,designatethepathtotheUNIX#socketusedtocommunicatewiththeCGIdaemonofmod_cgid.##Scriptsockcgisock</IfModule>##"/site01/program/apache/cgi-bin"shouldbechangedtowhateveryourScriptAliased#CGIdirectoryexists,ifyouhavethatconfigured.#<Directory"/site01/program/apache/cgi-bin">AllowOverrideNoneOptionsNoneRequireallgranted</Directory><IfModulemime_module>##TypesConfigpointstothefilecontainingthelistofmappingsfrom#filenameextensiontoMIME-type.#TypesConfigconf/mime.types##AddTypeallowsyoutoaddtooroverridetheMIMEconfiguration#filespecifiedinTypesConfigforspecificfiletypes.##AddTypeapplication/x-gzip.tgz##AddEncodingallowsyoutohavecertainbrowsersuncompress#informationonthefly.Note:Notallbrowserssupportthis.##AddEncodingx-compress.Z#AddEncodingx-gzip.gz.tgz##IftheAddEncodingdirectivesabovearecommented-out,thenyou#probablyshoulddefinethoseextensionstoindicatemediatypes:#AddTypeapplication/x-compress.ZAddTypeapplication/x-gzip.gz.tgz##AddHandlerallowsyoutomapcertainfileextensionsto"handlers":#actionsunrelatedtofiletype.Thesecanbeeitherbuiltintotheserver#oraddedwiththeActiondirective(seebelow)##TouseCGIscriptsoutsideofScriptAliaseddirectories:#(Youwillalsoneedtoadd"ExecCGI"tothe"Options"directive.)##AddHandlercgi-script.cgi#Fortypemaps(negotiatedresources):#AddHandlertype-mapvar##Filtersallowyoutoprocesscontentbeforeitissenttotheclient.##Toparse.shtmlfilesforserver-sideincludes(SSI):#(Youwillalsoneedtoadd"Includes"tothe"Options"directive.)#AddTypetext/html.htm.html.shtmAddOutputFilterINCLUDES.htm.html.shtm</IfModule>##Themod_mime_magicmoduleallowstheservertousevarioushintsfromthe#contentsofthefileitselftodetermineitstype.TheMIMEMagicFile#directivetellsthemodulewherethehintdefinitionsarelocated.##MIMEMagicFileconf/magic##Customizableerrorresponsescomeinthreeflavors:#1)plaintext2)localredirects3)externalredirects##Someexamples:#ErrorDocument500"Theservermadeabooboo."#ErrorDocument404/missing.html#ErrorDocument404"/cgi-bin/missing_handler.pl"#ErrorDocument402http://www.example.com/subscription_info.html###MaxRanges:MaximumnumberofRangesinarequestbefore#returningtheentireresource,oroneofthespecial#values'default','none'or'unlimited'.#Defaultsettingistoaccept200Ranges.#MaxRangesunlimited##EnableMMAPandEnableSendfile:Onsystemsthatsupportit,#memory-mappingorthesendfilesyscallmaybeusedtodeliver#files.Thisusuallyimprovesserverperformance,butmust#beturnedoffwhenservingfromnetworked-mounted#filesystemsorifsupportforthesefunctionsisotherwise#brokenonyoursystem.#Defaults:EnableMMAPOn,EnableSendfileOff##EnableMMAPoff#EnableSendfileon#Supplementalconfiguration##Theconfigurationfilesintheconf/extra/directorycanbe#includedtoaddextrafeaturesortomodifythedefaultconfigurationof#theserver,oryoumaysimplycopytheircontentshereandchangeas#necessary.#Server-poolmanagement(MPMspecific)#Includeconf/extra/httpd-mpm.conf#Multi-languageerrormessages#Includeconf/extra/httpd-multilang-errordoc.conf#Fancydirectorylistings#Includeconf/extra/httpd-autoindex.conf#Languagesettings#Includeconf/extra/httpd-languages.conf#Userhomedirectories#Includeconf/extra/httpd-userdir.conf#Real-timeinfoonrequestsandconfiguration#Includeconf/extra/httpd-info.conf#VirtualhostsIncludeconf/extra/httpd-vhosts.conf#LocalaccesstotheApacheHTTPServerManual#Includeconf/extra/httpd-manual.conf#Distributedauthoringandversioning(WebDAV)#Includeconf/extra/httpd-dav.conf#Variousdefaultsettings#Includeconf/extra/httpd-default.conf#Configuremod_proxy_htmltounderstandHTML4/XHTML1<IfModuleproxy_html_module>Includeconf/extra/proxy-html.conf</IfModule>#Secure(SSL/TLS)connections#Includeconf/extra/httpd-ssl.conf##Note:Thefollowingmustmustbepresenttosupport#startingwithoutSSLonplatformswithno/dev/randomequivalent#butastaticallycompiled-inmod_ssl.#<IfModulessl_module>SSLRandomSeedstartupbuiltinSSLRandomSeedconnectbuiltin</IfModule>##uncommentoutthebelowtodealwithuseragentsthatdeliberately#violateopenstandardsbymisusingDNT(DNT mustbeaspecific#end-userchoice)##<IfModulesetenvif_module>#BrowserMatch"MSIE10.0;"bad_DNT#</IfModule>#<IfModuleheaders_module>#RequestHeaderunsetDNTenv=bad_DNT#</IfModule>includeconf/mod_jk.conf 你apache2.4下面的那个重写咋写的啊http://www.oschina.net/question/77331_2143982--帮忙看看,啥地方没写好啊,我也是在原来IIS里面,可以使用,可是换了服务器就不行了回复<aclass='referer'target='_blank'>@皮总:谢谢皮总,搞定了,我正则在windows下好用,linux不好用,换了个方式就好了还不够全啊,你的Rewrite相关的没有出来
爱吃鱼的程序员 2020-06-22 19:46:06 0 浏览量 回答数 0

回答

解决方案 Python 的星号表达式可以用来解决这个问题。比如,你在学习一门课程,在学期末的时候, 你想统计下家庭作业的平均成绩,但是排除掉第一个和最后一个分数。如果只有四个分数,你可能就直接去简单的手动赋值, 但如果有 24 个呢?这时候星号表达式就派上用场了: def drop_first_last(grades): first, *middle, last = grades return avg(middle) 另外一种情况,假设你现在有一些用户的记录列表,每条记录包含一个名字、邮件,接着就是不确定数量的电话号码。 你可以像下面这样分解这些记录: >>> record = ('Dave', 'dave@example.com', '773-555-1212', '847-555-1212') >>> name, email, *phone_numbers = record >>> name 'Dave' >>> email 'dave@example.com' >>> phone_numbers ['773-555-1212', '847-555-1212'] >>> 值得注意的是上面解压出的 phone_numbers 变量永远都是列表类型,不管解压的电话号码数量是多少(包括 0 个)。 所以,任何使用到 phone_numbers 变量的代码就不需要做多余的类型检查去确认它是否是列表类型了。 星号表达式也能用在列表的开始部分。比如,你有一个公司前 8 个月销售数据的序列, 但是你想看下最近一个月数据和前面 7 个月的平均值的对比。你可以这样做: *trailing_qtrs, current_qtr = sales_record trailing_avg = sum(trailing_qtrs) / len(trailing_qtrs) return avg_comparison(trailing_avg, current_qtr) 下面是在 Python 解释器中执行的结果: >>> *trailing, current = [10, 8, 7, 1, 9, 5, 10, 3] >>> trailing [10, 8, 7, 1, 9, 5, 10] >>> current 3 ### 讨论 扩展的迭代解压语法是专门为解压不确定个数或任意个数元素的可迭代对象而设计的。 通常,这些可迭代对象的元素结构有确定的规则(比如第 1 个元素后面都是电话号码), 星号表达式让开发人员可以很容易的利用这些规则来解压出元素来。 而不是通过一些比较复杂的手段去获取这些关联的元素值。 值得注意的是,星号表达式在迭代元素为可变长元组的序列时是很有用的。 比如,下面是一个带有标签的元组序列: records = [ ('foo', 1, 2), ('bar', 'hello'), ('foo', 3, 4), ] def do_foo(x, y): print('foo', x, y) def do_bar(s): print('bar', s) for tag, *args in records: if tag == 'foo': do_foo(*args) elif tag == 'bar': do_bar(*args) 星号解压语法在字符串操作的时候也会很有用,比如字符串的分割。 *代码示例:* >>> line = 'nobody:*:-2:-2:Unprivileged User:/var/empty:/usr/bin/false' >>> uname, *fields, homedir, sh = line.split(':') >>> uname 'nobody' >>> homedir '/var/empty' >>> sh '/usr/bin/false' >>> 有时候,你想解压一些元素后丢弃它们,你不能简单就使用 * , 但是你可以使用一个普通的废弃名称,比如 _ 或者 ign (ignore)。 *代码示例:* >>> record = ('ACME', 50, 123.45, (12, 18, 2012)) >>> name, *_, (*_, year) = record >>> name 'ACME' >>> year 2012 >>> 在很多函数式语言中,星号解压语法跟列表处理有许多相似之处。比如,如果你有一个列表, 你可以很容易的将它分割成前后两部分: >>> items = [1, 10, 7, 4, 5, 9] >>> head, *tail = items >>> head 1 >>> tail [10, 7, 4, 5, 9] >>> 如果你够聪明的话,还能用这种分割语法去巧妙的实现递归算法。比如: >>> def sum(items): ... head, *tail = items ... return head + sum(tail) if tail else head ... >>> sum(items) 36 >>> 然后,由于语言层面的限制,递归并不是 Python 擅长的。 因此,最后那个递归演示仅仅是个好奇的探索罢了,对这个不要太认真了。
问答小能手! 2020-12-09 17:38:52 0 浏览量 回答数 0

问题

Lua直接调用动态链接库(DLL或so文件):报错

使用Lua编程,扩展外部接口时,不一定要编写lua专用的dll,使用系统的,或传统的动态链接库也可以,这样更具有通用性。 基本用法: require(&...
kun坤 2020-06-08 11:01:53 3 浏览量 回答数 1

回答

这不是一个规定,而是一种约定。一些早期的工具(编辑器/解释器/终端……等)会错误地认为:如果一个文件的结尾不是新行(没有回车或换行符)那么它读取到的内容不是正常结束,而是使用 ^Z(即 EOF Mark)结束的。这会导致这些工具不能正常工作。一些编辑器,比如 Nano,会自动给每一个文档追加一个新行以避免这个问题。自然而然的,如果一个项目里有人使用了类似 Nano 的编辑器来写代码,他贡献的文件理所当然会有一个新行在结尾。那么制定代码规范的人也就理所当然的要求所有的人遵循这个约定。虽然现在的编辑器大都先进到可以无视(自动处理)这个问题,但是留一个空行始终还是有一个巨大的好处。假设文件 foo.txt 里的内容就是 foo,结尾没有新行,那么你在终端输出其内容的时候会是这样的:$ more foo.txtfoo $ _假设文件 bar.txt 里的内容是 bar,结尾有一个新行,那么你在终端输出其内容的时候就是这样的:$ more bar.txtbar$ _留意提示符的位置。于是你可以想到,如果把上述两文件连接起来就会是这样的:$ cat *.txtfoobar$ _但如果它们的结尾都有新行,那就不同了:$ cat *.txtfoobar$ _Which one do you prefer?
a123456678 2019-12-02 02:54:21 0 浏览量 回答数 0

问题

查询期间失去与MySQL服务器的连接

我有一个巨大的表,我需要处理其中的所有行。我总是收到此“丢失的连接”消息,并且无法重新连接并将光标恢复到原来的位置。这基本上是我在这里的代码: import MySQLdb class DB...
保持可爱mmm 2020-05-10 22:27:53 0 浏览量 回答数 1

回答

你都已经查到 __stdcall这一步了,再往下多查一步不就知道了么。调用者(caller)和被调用者(callee)都是指函数。入栈清栈指的是函数调用参数传递的方式。清栈职责在caller这边,意思就是:foo(123);转换成汇编是:push 123;call foo;add $4,%esp; #将Stack Pointer %esp 加4即是清栈 #4表示32位下4个字节一个word如果职责在callee那边,上面最后一行就移到foo中:foo: # do something add $4,%esp ret后一种方式一个函数只能接受固定个数的参数,因为编译时就需要确定 add x,%esp中x到底是几。哦,对了,这些都是编译器的行为,程序员根本不需要关心。
a123456678 2019-12-02 02:39:03 0 浏览量 回答数 0

回答

一. 表单传递当一个表单提交给 PHP 脚本时,表单中的信息会自动在脚本中可用。例: 一个简单的 HTML 表单[PHP] <form action="foo.php" method="post"> Name: <input type="text" name="username"><br> Email: <input type="text" name="email"><br> <input type="submit" name="submit" value="Submit me!"> </form> [/PHP]有很多种方法访问 HTML 表单中的数据。例如:例:. 从一个简单的 POST HTML 表单访问数据[PHP] <?php // 自 PHP 4.1.0 起可用 print $_POST['username']; print $_REQUEST['username']; import_request_variables('p', 'p_'); print $p_username; // 自 PHP 3 起可用 print $HTTP_POST_VARS['username']; // 如果 PHP 指令 register_globals = on 时可用。不过自 // PHP 4.2.0 起默认值为 register_globals = off。 // 不提倡使用/依赖此种方法。 print $username; ?> [/PHP]使用 GET 表单也类似,只不过要用适当的 GET 预定义变量。当提交表单时,可以用一幅图像代替标准的提交按钮,用类似这样的标记: ` <input type="image" src="image.gif" name="sub">` 当用户点击到图像中的某处时,相应的表单会被传送到服务器,并加上两个变量 sub_x 和 sub_y。它们包含了用户点击图像的坐标。有经验的用户可能会注意到被浏览器发送的实际变量名包含的是一个点而不是下划线,但 PHP 自动将点转换成了下划线。 二. 网址传递<a href=”test.php?id=3&name=mike”>next</a>可用 $_GET['id'] 和$_GET['name']访问GET 的数据。三. Cookie 传递1、 设置Cookie简单的:SetCookie("MyCookie", "Value of MyCookie");  带失效时间的:SetCookie("WithExpire", "Expire in 1 hour", time()+3600);//3600秒=1小时  什么都有的:SetCookie("FullCookie", "Full cookie value", time()+3600, "/forum", ".phpuser.com", 1);  如果要设置同名的多个Cookie,要用数组,方法是: SetCookie("CookieArray[0]", "Value 1"); SetCookie("CookieArray[1]", "Value 2"); 2、 接收和处理Cookie echo $_COOKIE[‘MyCookie’]; echo $_COOKIE[‘CookieArray[0]’]; echo count($_COOKIE[‘CookieArray’]); 3、删除Cookie要删除一个已经存在的Cookie,有两个办法: 一是调用只带有name参数的SetCookie,那么名为这个name的Cookie 将被从关系户机上删掉;另一个办法是设置Cookie的失效时间为time()或time()-1,那么这个Cookie在这个页面的浏览完之后就被删除了(其实是失效了)。 要注意的是,当一个Cookie被删除时,它的值在当前页在仍然有效的。 四. Session传递test1.php [PHP] <? session_start(); session_register("count"); echo $count=0; ?> [/PHP] test2.php[PHP] <? session_start(); echo $count++; ?> [/PHP] 经过实验发现,PHP4的session只对当前打开的浏览器窗口有效(至少在W2K下的 IE5和NS6中是这样)。下面的代码可以实现session的跨窗口执行。 test1.php [PHP] <? session_start(); session_register("count"); setcookie("PHPSESSID",session_id(),time()+3600,"/","www.md.hl.cn"); echo $count=0; ?> [/PHP]五. javascript变量传递到PHP脚本中方法一:先用PHP生成js代码,然后通过浏览器的自动刷新,将javascript变量传递到PHP脚本中。[PHP] <?php if (isset($_GET['width']) AND isset($_GET['height'])) { // output the geometry variables echo "Screen width is: ". $_GET['width'] ."<br />\n"; echo "Screen height is: ". $_GET['height'] ."<br />\n"; } else { // pass the geometry variables // (preserve the original query string // -- post variables will need to handled differently) echo "<script language=\"javascript\">\n"; echo " location.href=\"${_SERVER['SCRIPT_NAME']}?${_SERVER['QUERY_STRING']}" . "&width=\" + screen.width + \"&height=\" + screen.height;\n"; echo "</script>\n"; exit(); } ?> [/PHP] 方法二:先用document.cookie方法把js变量写入cookie中,再用PHP取出。这种方法适用于变量少的情况。 1. 在JAVASCRIPT中设置COOKIE:document.cookie="cookiename="+value+";path=/" 2. 在PHP中用$HTTP_COOKIE_VARS["cookiename"]的方式读取。 [PHP] <script> var name="myqq",value="66166457"; document.cookie=”myqq”+"="+value+";" </script> <?php echo "$_COOKIE[‘myqq’]\n"; $my="我的QQ是".$_COOKIE[‘myqq’]; echo $my; ?> [/PHP]方法三:通过表单中的隐藏域的value属性将需要传递的变量通过提交表单传递给PHP。[PHP] <script langeuage="javascript"> function logon_sub(){ if( pass_check() ) { if(document.logon.f_over_clk.value=='0') { document.logon.f_over_clk.value='1'; document.logon.submit(); } } } </script> <form name="logon" action="logon_do.php" method="post"> <a href="javascript:logon_sub();"><img name="Logon" src="../img/LogonBt_iu.gif"></a> <input type="hidden" name="mullang" value="0"> </form> [/PHP] 在logon_do.php页面就可以用$_POST[‘mullang’]取得这个变量了。六.多个页面之间传递数组可以把数组转化成字符串,作为一个参数来传递: - file1.php [PHP] <? ... $arg=implode(";", $parm); $link="file2.php?arg=$arg"; ?> [/PHP] - file2.php [PHP] <? $parm=explode(";", $arg);
小旋风柴进 2019-12-02 02:01:31 0 浏览量 回答数 0

回答

1.字符串转义序列转义字符 描述(在行尾时) 续行符\ 反斜杠符号' 单引号" 双引号a 响铃b 退格(Backspace)e 转义000 空n 换行v 纵向制表符t 横向制表符r 回车f 换页oyy 八进制数yy代表的字符,例如:o12代表换行xyy 十进制数yy代表的字符,例如:x0a代表换行other 其它的字符以普通格式输出 2.字符串格式化 3.操作符 一、算术运算符 注意: 双斜杠 // 除法总是向下取整。 从符点数到整数的转换可能会舍入也可能截断,建议使用math.floor()和math.ceil()明确定义的转换。 Python定义pow(0, 0)和0 ** 0等于1。 二、比较运算符 运算符 描述< 小于<= 小于或等于 大于= 大于或等于== 等于 != 不等于is 判断两个标识符是不是引用自一个对象is not 判断两个标识符是不是引用自不同对象注意: 八个比较运算符优先级相同。 Python允许x < y <= z这样的链式比较,它相当于x < y and y <= z。 复数不能进行大小比较,只能比较是否相等。 三、逻辑运算符 运算符 描述 备注x or y if x is false, then y, elsex x andy if x is false, then x, elsey not x if x is false, then True,elseFalse 注意: or是个短路运算符,它只有在第一个运算数为False时才会计算第二个运算数的值。 and也是个短路运算符,它只有在第一个运算数为True时才会计算第二个运算数的值。 not的优先级比其他类型的运算符低,所以not a == b相当于not (a == b),而 a == not b是错误的。 四、位运算符 运算符 描述 备注x | y 按位或运算符 x ^ y 按位异或运算符 x & y 按位与运算符 x << n 左移动运算符 x >> n 右移动运算符 ~x 按位取反运算符 五、赋值运算符 复合赋值运算符与算术运算符是一一对应的: 六、成员运算符 Python提供了成员运算符,测试一个元素是否在一个序列(Sequence)中。 运算符 描述in 如果在指定的序列中找到值返回True,否则返回False。not in 如果在指定的序列中没有找到值返回True,否则返回False。 4.关键字总结 Python中的关键字包括如下: and del from not while as elif global or with assert else if pass yield break except import print class exec in raise continue finally is return def for lambda try你想看看有哪些关键字?OK,打开一个终端,就像这样~ long@zhouyl:~$ pythonPython 2.7.3 (default, Jan 2 2013, 16:53:07) [GCC 4.7.2] on linux2Type "help", "copyright", "credits" or "license" for more information. import keywordkeyword.kwlist ['and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'exec', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'not', 'or', 'pass', 'print', 'raise', 'return', 'try', 'while', 'with', 'yield'] ============================== 华丽的 正文分隔符 ======================================== 看到这些关键字你还能记得多少?你不妨自己一个一个对照想想它的用法,下面是我总结的,我根据前面的学习笔记将上述关键字分为以下几类: 1.判断、循环 对于Python的循环及判断主要包括这些关键字: if elif else for while break continue and or is not in 这几个关键字在前面介绍 if 语法、while语法、for语法以及and...or语法中已有介绍,下面再一笔带过: 1.1 if 语法 if语法与C语言、shell脚本之下的非常类似,最大的区别就是冒号以及严格的缩进,当然这两点也是Python区别于其他语言的地方: if condition1: do something elif condition2: do another thing else: also do something 1.2 while 语法 Python的while语法区别于C、shell下的while除了冒号及缩进之外,还有一点就是while可以携带一个可选的else语句: while condition: do something else: do something 注:else语句是可选的,但是使用while语句时一定要注意判断语句可以跳出! 1.3 for 语法 与while类似,Python的for循环也包括一个可选的else语句(跳出for循环时执行,但是如果是从break语句跳出则不执行else语句块中的代码!),而且for 加上 关键字in就组成了最常见的列表解析用法(以后会写个专门的博客)。 下面是for的一般用法: for i in range(1,10,2): do something if condition: break else: do something for的列表解析用法: for items in list: print items 1.4 and...or 语法 Python的and/or操作与其他语言不同的是它的返回值是参与判断的两个值之一,所以我们可以通过这个特性来实现Python下的 a ? b : c ! 有C语言基础的知道 “ a ? b : c ! ” 语法是判断 a,如果正确则执行b,否则执行 c! 而Python下我们可以这么用:“ a and b or c ”(此方法中必须保证b必须是True值),python自左向右执行此句,先判断a and b :如果a是True值,a and b语句仍需要执行b,而此时b是True值!所以a and b的值是b,而此时a and b or c就变成了b or c,因b是True值,所以b or c的结果也是b;如果a是False值,a and b语句的结果就是a,此时 a and b or c就转化为a or c,因为此时a是 False值,所以不管c是True 还是Flase,a or c的结果就是c!!!捋通逻辑的话,a and b or c 是不是就是Python下的a ? b : c ! 用法? 1.5 is ,not is 和 is not 是Python下判断同一性的关键字,通常用来判断 是 True 、False或者None(Python下的NULL)! 比如 if alue is True : ... (不记得本节的童鞋罚复习:python 学习笔记 2 -- 判断语句) 2.函数、模块、类 对于Python的函数及模块主要包括这些关键字: from import as def pass lambda return class 那么你还能记得它们么?下面简单介绍一下: 2.1 模块 Python的编程通常大量使用标准库中的模块,使用方法就是使用import 、from以及as 关键字。 比如: import sys # 导入sys模块 from sys import argv # 从sys模块中导入argv ,这个在前面介绍脚本传参数时使用到 import cPickle as p # 将cPickle模块导入并在此将它简单命名为p,此后直接可以使用p替代cPickle模块原名,这个在介绍文件输入输出时的存储器中使用到 2.2 函数 Python中定义函数时使用到def关键字,如果你当前不想写入真实的函数操作,可以使用pass关键字指代不做任何操作: def JustAFunction: pass 当然,在需要给函数返回值时就用到了return关键字,这里简单提一下Python下的函数返回值可以是多个(接收返回值时用相应数量的变量接收!)! 此外Python下有个神奇的Lambda函数,它允许你定义单行的最小函数,这是从Lisp中借用来的,可以用在任何需要函数的地方。比如: g = lambda x : x*2 # 定义一个Lambda函数用来计算参数的2倍并返回! print g(2) # 使用时使用lambda函数返回的变量作为这个函数的函数名,括号中带入相应参数即可! (不记得本节的童鞋罚复习:python 学习笔记 4 -- 函数篇) 3.异常 对于Python的异常主要包括这些关键字: try except finally raise 异常这一节还是比较简单的,将可能出现的异常放在 try: 后面的语句块中,使用except关键字捕获一定的异常并在接下来的语句块中做相应操作,而finally中接的是无论出现什么异常总在执行最后做finally: 后面的语句块(比如关闭文件等必要的操作!) raise关键字是在一定的情况下引发异常,通常结合自定义的异常类型使用。 (不记得本节的童鞋罚复习:python 学习笔记 6 -- 异常处理) 4.其他 上面的三类过后,还剩下这些关键字: print del global with assert yield exec 首先print 在前面的笔记或者任何地方你都能见到,所以还是比较熟悉的,此处就不多介绍了!del 关键字在前面的笔记中已有所涉及,比如删除列表中的某项,我们使用 “ del mylist[0] ” 可能这些剩下来的关键字你比较陌生,所以下面来介绍一下: 4.1.global 关键字 当你在函数定义内声明变量的时候,它们与函数外具有相同名称的其他变量没有任何关系,即变量名称对于函数来说是 局部 的。这称为变量的 作用域 。所有变量的作用域是它们被定义的块,从它们的名称被定义的那点开始。 eg. ? 1 2 3 4 5 6 7 8 9 10 11 !/usr/bin/python Filename: func_local.py def func(x): print'x is', x x = 2 print'Changed local x to', x x = 50 func(x) print'x is still', x 运行的结果是这样的:? 1 2 3 4 $ python func_local.py x is 50 # 运行func函数时,先打印x的值,此时带的值是作为参数带入的外部定义的50,所以能正常打印 x=50 Changed local x to 2 # 在func函数中将x赋2,并打印 x is still 50 # 运行完func函数,打印x的值,此时x的值仍然是之前赋给的50,而不是func函数中修改过的2,因为在函数中修改的只是函数内的局部变量 那么为什么我们要在这提到局部变量呢?bingo,聪明的你一下就猜到这个global就是用来定义全局变量的。也就是说如果你想要为一个在函数外定义的变量赋值,那么你就得告诉Python这个变量名不是局部的,而是 全局 的。我们使用global语句完成这一功能。没有global语句,是不可能为定义在函数外的变量赋值的。eg.? 1 2 3 4 5 6 7 8 9 10 11 12 !/usr/bin/python Filename: func_global.py def func(): global x print'x is', x x = 2 print'Changed local x to', x x = 50 func() print'Value of x is', x 运行的结果是这样的:? 1 2 3 4 $ python func_global.py x is 50 Changed global x to 2 Value of x is 2 # global语句被用来声明x是全局的——因此,当我们在函数内把值赋给x的时候,这个变化也反映在我们在主块中使用x的值的时候。 你可以使用同一个global语句指定多个全局变量。例如global x, y, z。 4.2.with 关键字 有一些任务,可能事先需要设置,事后做清理工作。对于这种场景,Python的with语句提供了一种非常方便的处理方式。一个很好的例子是文件处理,你需要获取一个文件句柄,从文件中读取数据,然后关闭文件句柄。如果不用with语句,打开一个文件并读文件的代码如下:? 1 2 3 file = open("/tmp/foo.txt") data = file.read() file.close() 当然这样直接打开有两个问题:一是可能忘记关闭文件句柄;二是文件读取数据发生异常,没有进行任何处理。下面是添加上异常处理的版本:? 1 2 3 4 5 file = open("/tmp/foo.txt") try: data = file.read() finally: file.close() 虽然这段代码运行良好,但是太冗余了。这时候就是with一展身手的时候了。除了有更优雅的语法,with还可以很好的处理上下文环境产生的异常。下面是with版本的代码:? 1 2 with open("/tmp/foo.txt") as file: data = file.read() 这看起来充满魔法,但不仅仅是魔法,Python对with的处理还很聪明。基本思想是with所求值的对象必须有一个__enter__()方法,一个__exit__()方法。with语句的执行逻辑如下:紧跟with后面的语句被求值后,返回对象的__enter__()方法被调用,这个方法的返回值将被赋值给as后面的变量。当with后面的代码块全部被执行完之后,将调用前面返回对象的__exit__()方法。 下面例子可以具体说明with如何工作:? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 !/usr/bin/python with_example01.py classSample: def __enter__(self): print"In __enter__()" return"Foo" def __exit__(self, type, value, trace): print"In __exit__()" def get_sample(): returnSample() with get_sample() as sample: print"sample:", sample 运行代码,输出如下? 1 2 3 4 $python with_example01.py In __enter__() # __enter__()方法被执行 sample: Foo # __enter__()方法返回的值 - 这个例子中是"Foo",赋值给变量'sample',执行代码块,打印变量"sample"的值为"Foo" In __exit__() # __exit__()方法被调用 4.3.assert 关键字 assert语句是一种插入调试断点到程序的一种便捷的方式。assert语句用来声明某个条件是真的,当assert语句失败的时候,会引发一AssertionError,所以结合try...except我们就可以处理这样的异常。 mylist # 此时mylist是有三个元素的列表['a', 'b', 'c']assert len(mylist) is not None # 用assert判断列表不为空,正确无返回assert len(mylist) is None # 用assert判断列表为空 Traceback (most recent call last): File "", line 1, in AssertionError # 引发AssertionError异常 4.4.yield 关键字 我们先看一个示例:? 1 2 3 4 5 6 7 8 def fab(max): n, a, b = 0,0,1 whilen < max: yield b # print b a, b = b, a + b n = n + 1 ''' 使用这个函数:? 1 2 3 4 5 6 7 8 forn in fab(5): ... print n ... 1 1 2 3 5 简单地讲,yield 的作用就是把一个函数变成一个 generator(生成器),带有 yield 的函数不再是一个普通函数,Python 解释器会将其视为一个 generator,调用 fab(5) 不会执行 fab 函数,而是返回一个 iterable(可迭代的)对象!在 for 循环执行时,每次循环都会执行 fab 函数内部的代码,执行到 yield b 时,fab 函数就返回一个迭代值,下次迭代时,代码从 yield b 的下一条语句继续执行,而函数的本地变量看起来和上次中断执行前是完全一样的,于是函数继续执行,直到再次遇到 yield。也可以手动调用 fab(5) 的 next() 方法(因为 fab(5) 是一个 generator 对象,该对象具有 next() 方法),这样我们就可以更清楚地看到 fab 的执行流程:? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 f = fab(5) f.next() 1 f.next() 1 f.next() 2 f.next() 3 f.next() 5 f.next() Traceback (most recent call last): File"", line 1, in StopIteration 当函数执行结束时,generator 自动抛出 StopIteration 异常,表示迭代完成。在 for 循环里,无需处理 StopIteration 异常,循环会正常结束。 我们可以得出以下结论:一个带有 yield 的函数就是一个 generator,它和普通函数不同,生成一个 generator 看起来像函数调用,但不会执行任何函数代码,直到对其调用 next()(在 for 循环中会自动调用 next())才开始执行。虽然执行流程仍按函数的流程执行,但每执行到一个 yield 语句就会中断,并返回一个迭代值,下次执行时从 yield 的下一个语句继续执行。看起来就好像一个函数在正常执行的过程中被 yield 中断了数次,每次中断都会通过 yield 返回当前的迭代值。 yield 的好处是显而易见的,把一个函数改写为一个 generator 就获得了迭代能力,比起用类的实例保存状态来计算下一个 next() 的值,不仅代码简洁,而且执行流程异常清晰。 注:如果看完此段你还未明白yield,没问题,因为yield是初学者的一个难点,那么你下一步需要做的就是……看一看下面参考资料中给的关于yield的博文! 4.5.exec 关键字 官方文档对于exec的解释: "This statement supports dynamic execution of Python code."也就是说使用exec可以动态执行Python代码(也可以是文件)。? 1 2 3 4 5 6 7 8 9 10 11 12 13 longer = "print "Hello World ,my name is longer"" # 比如说我们定义了一个字符串 longer 'print "Hello World ,my name is longer"' exec(longer) # 使用exec 动态执行字符串中的代码 Hello World ,my name is longer exec(sayhi) # 使用exec直接打开文件名(指定sayhi,sayhi.py以及"sayhi.py"都会报一定的错,但是我觉得直接带sayhi报错非常典型) Traceback (most recent call last): File"", line 1, in TypeError: exec: arg 1must be a string, file, or code object # python IDE报错,提示exec的第一个参 数必须是一个字符串、文件或者一个代码对象 f = file("sayhi.py") # 使用file打开sayhi.py并创建f实例 exec(f) # 使用exec直接运行文件描述符f,运行正常!! Hi,thisis [''] script 上述给的例子比较简单,注意例子中exec语句的用法和eval_r(), execfile()是不一样的. exec是一个关键字(要不然我怎么会在这里介绍呢~~~), 而eval_r()和execfile()则是内建函数。更多关于exec的使用请详看引用资料或者Google之 在需要在字符中使用特殊字符时,python用反斜杠()转义字符。 原始字符串 有时我们并不想让转义字符生效,我们只想显示字符串原来的意思,这就要用r和R来定义原始字符串。如: print r’tr’ 实际输出为“tr”。 转义字符 描述 (在行尾时) 续行符 反斜杠符号 ’ 单引号 ” 双引号 a 响铃 b 退格(Backspace) e 转义 000 空 n 换行 v 纵向制表符 t 横向制表符 r 回车 f 换页 oyy 八进制数yy代表的字符,例如:o12代表换行 xyy 十进制数yy代表的字符,例如:x0a代表换行 other 其它的字符以普通格式输出
xuning715 2019-12-02 01:10:21 0 浏览量 回答数 0

问题

python 2.6。单元测试框架断言:需要帮助

我正在使用该unittest框架在python 2.6中编写测试套件,并且想在代码中使用断言。我知道asserts进行了全面的检查,并且在2.7+中要好得多,但是目前仅限于使用2.6。 我...
祖安文状元 2020-02-24 09:56:15 9 浏览量 回答数 1

问题

你可能不知道的 Python 技巧有哪些?

有许许多多文章写了 Python 中的许多很酷的特性,例如变量解包、偏函数、枚举可迭代对象,但是关于 Python 还有很多要讨论的话题,因此在本文中,我将尝试展示一些我知道的和在使用...
游客bnlxddh3fwntw 2020-04-13 11:34:27 33 浏览量 回答数 1

问题

使用 Jedis 连接池模式容易遇到无法获取连接池的错误有哪些

使用 Jedis 连接池模式容易遇到无法获取连接池的错误如下所示。 redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from...
云栖大讲堂 2019-12-01 21:20:52 1097 浏览量 回答数 0

问题

您可以在子活动中使用构造函数来更改“父母活动字符串”变量吗?

我有一个父活动类,我的所有子活动类都从中扩展。此父活动具有一个名为“ activity_Id”的字段,该字段为字符串,默认为空。 在父活动的onCreate中,我需要检查该字段是否具...
LiuWH 2020-01-17 09:52:20 1 浏览量 回答数 1

回答

当你需要这样调用方法的时候 def foo end foo { "this is block param." } 现实点的场景,比如你需要给 Views 定一个 space_less Helper 方法,清除区域内的 HTML 的空白字符,使得调用起来可以这样: <%= spaceless do %> <html> <body> <head></head> </body> <% end %> 这个时候,你就需要用 yield 来定义一个可以接收 block 作为参数的方法了 module ApplicationHelper def splace_less body = yield body.gsub!(/\s+/,'') body end end
心有灵_夕 2019-12-29 00:26:32 0 浏览量 回答数 0

回答

因为需要实际动手操作,你至少有一个Hadoop集群能正常运行,如果你没有Hadoop集群的话,下面的教程可以帮你建立一个。下面的教程是基于Ubuntu系统建立的,但是你可以将他们应用到其它Linux、Unix系统上。 Running Hadoop On Ubuntu Linux (Multi-Node Cluster) Running Hadoop On Ubuntu Linux (Single-Node Cluster) Python MapReduce 源码解析 以下Python代码所使用的技巧是基于Hadoop 数据流的接口实现的。借助该接口,我们可以通过标准输入(stdin)和标准输出(stdout)来传递Map和Reduce过程之间的数据。这里我们简单地使用Python的sys.stdin读取数据并通过sys.stdout输出数据,剩下的事情就全交给Hadoop啦~ Map 将以下代码写入 /home/hduser/mapper.py 它会从stdin读取数据,分割其中的单词然后按行输出单词和其词频到stdout 。不过整个Map处理过程并不会统计每个单词出现总的次数,而是直接输出( , 1)元组。尽管某些单词会出现不止一次,但只要单词出现一次我们就输出一个( , 1)元组。在接下来的Reduce过程我们会统计单词出现的总的次数。当然,你也可以不这么做,但是出于“教程”这一目的,接下来的内容会按照这一思路来写。 :-) 注意:确保该文件是可执行的(chmod +x /home/hduser/mapper.py),否则会出问题。另外第一行记得添加 #!/usr/bin/env python mapper.py 01 #!/usr/bin/env python 02 03 import sys 04 05 # input comes from STDIN (standard input) 06 for line in sys . stdin : 07 # remove leading and trailing whitespace 08 line = line . strip() 09 # split the line into words 10 words = line . split() 11 # increase counters 12 for word in words : 13 # write the results to STDOUT (standard output); 14 # what we output here will be the input for the 15 # Reduce step, i.e. the input for reducer.py 16 # 17 # tab-delimited; the trivial word count is 1 18 print ' %s \t %s ' % ( word , 1) Reduce 将以下代码保存到/home/hduser/reducer.py 它会从stdin读取mapper.py的结果(因此mapper.py的输出格式应该与reducer.py的输入格式一致),然后统计每个单词出现的总的次数并输出到stdout 注意:确保该文件是可执行的(chmod +x /home/hduser/mapper.py),否则会出问题。另外第一行记得添加 #!/usr/bin/env python reducer.py 01 #!/usr/bin/env python 02 03 from operator import itemgetter 04 import sys 05 06 current_word = None 07 current_count = 0 08 word = None 09 10 # input comes from STDIN 11 for line in sys . stdin : 12 # remove leading and trailing whitespace 13 line = line . strip() 14 15 # parse the input we got from mapper.py 16 word , count = line . split( ' \t ' , 1) 17 18 # convert count (currently a string) to int 19 try : 20 count = int( count) 21 except ValueError : 22 # count was not a number, so silently 23 # ignore/discard this line 24 continue 25 26 # this IF-switch only works because Hadoop sorts map output 27 # by key (here: word) before it is passed to the reducer 28 if current_word == word : 29 current_count += count 30 else : 31 if current_word : 32 # write result to STDOUT 33 print ' %s \t %s ' % ( current_word , current_count) 34 current_count = count 35 current_word = word 36 37 # do not forget to output the last word if needed! 38 if current_word == word : 39 print ' %s \t %s ' % ( current_word , current_count) 测试你的代码(cat data | map | sort | reduce) 建议在Hadoop上实际运行mapreduce之前先在本地测试mapper.py和reducer.py否侧可能会出现程序能正常执行但却完全没有输出结果或者输出不是你想要的结果。如果这发生的话,多半是你自己搞砸了...... test 01 # very basic test 02 hduser@ubuntu:~ $ echo "foo foo quux labs foo bar quux" | /home/hduser/mapper.py 03 foo 1 04 foo 1 05 quux 1 06 labs 1 07 foo 1 08 bar 1 09 quux 1 10 11 hduser@ubuntu:~ $ echo "foo foo quux labs foo bar quux" | /home/hduser/mapper.py | sort -k1,1 | /home/hduser/reducer.py 12 bar 1 13 foo 3 14 labs 1 15 quux 2 16 17 # using one of the ebooks as example input 18 # (see below on where to get the ebooks) 19 hduser@ubuntu:~ $ cat /tmp/gutenberg/20417-8.txt | /home/hduser/mapper.py 20 The 1 21 Project 1 22 Gutenberg 1 23 EBook 1 24 of 1 25 [... ] 26 (you get the idea) 在Hadoop上运行 Python代码 下载测试用的输入数据 我们使用古腾堡项目中的三本电子书作为测试: The Outline of Science, Vol. 1 (of 4) by J. Arthur Thomson The Notebooks of Leonardo Da Vinci Ulysses by James Joyce 下载这些电子书的 txt格式,然后将这些文件保存到一个临时文件夹比如 /tmp/gutenberg 1 hduser@ubuntu:~ $ ls -l /tmp/gutenberg/ 2 total 3604 3 -rw-r--r-- 1 hduser hadoop 674566 Feb 3 10:17 pg20417.txt 4 -rw-r--r-- 1 hduser hadoop 1573112 Feb 3 10:18 pg4300.txt 5 -rw-r--r-- 1 hduser hadoop 1423801 Feb 3 10:18 pg5000.txt 6 hduser@ubuntu:~ $ 将本地的数据拷贝到HDFS上 在运行MapReduce任务之前,我们必须先将本地文件拷贝到Hadoop的文件系统上 01 hduser@ubuntu:/usr/local/hadoop $ bin/hadoop dfs -copyFromLocal /tmp/gutenberg /user/hduser/gutenberg 02 hduser@ubuntu:/usr/local/hadoop $ bin/hadoop dfs -ls 03 Found 1 items 04 drwxr-xr-x - hduser supergroup 0 2010-05-08 17:40 /user/hduser/gutenberg 05 hduser@ubuntu:/usr/local/hadoop $ bin/hadoop dfs -ls /user/hduser/gutenberg 06 Found 3 items 07 -rw-r--r-- 3 hduser supergroup 674566 2011-03-10 11:38 /user/hduser/gutenberg/pg20417.txt 08 -rw-r--r-- 3 hduser supergroup 1573112 2011-03-10 11:38 /user/hduser/gutenberg/pg4300.txt 09 -rw-r--r-- 3 hduser supergroup 1423801 2011-03-10 11:38 /user/hduser/gutenberg/pg5000.txt 10 hduser@ubuntu:/usr/local/hadoop $ 运行MapReduce任务 现在一切都准备好了,我们可以通过Hadoop的数据流API来传送Map和Reduce过程中间的数据。 1 hduser@ubuntu:/usr/local/hadoop $ bin/hadoop jar contrib/streaming/hadoop-streaming.jar 2 -file /home/hduser/mapper.py -mapper /home/hduser/mapper.py 3 -file /home/hduser/reducer.py -reducer /home/hduser/reducer.py 4 -input /user/hduser/gutenberg/* -output /user/hduser/gutenberg-output 你可以通过指定 -D参数来更改一些Hadoop 设置,比如增加reducer数量 1 hduser@ubuntu:/usr/local/hadoop $ bin/hadoop jar contrib/streaming/hadoop-streaming.jar -D mapred.reduce.tasks =16 ... 注意在命令行中可以接受mapred.reducetasks参数来指定reduce的个数,但是不能仅仅通过指定mapred.reduce.tasks来指定map tasks的个数。 整个任务会从HDFS的路径/user/huser/gutenberg 上读取所有的文件,然后处理并输出到HDFS的路径/user/huser/gutnberg-output事实上Hadoop会给每个reducer创建一个输出文件,在我们的例子中只会输出一个文件因为输入的文件很小。上面命令行的输出示例如下: 01 hduser@ubuntu:/usr/local/hadoop $ bin/hadoop jar contrib/streaming/hadoop-streaming.jar -mapper /home/hduser/mapper.py -reducer /home/hduser/reducer.py -input /user/hduser/gutenberg/* -output /user/hduser/gutenberg-output 02 additionalConfSpec_:null 03 null =@@@userJobConfProps_.get(stream.shipped.hadoopstreaming 04 packageJobJar: [/app/hadoop/tmp/hadoop-unjar54543/ ] 05 [] /tmp/streamjob54544.jar tmpDir =null 06 [... ] INFO mapred.FileInputFormat: Total input paths to process : 7 07 [... ] INFO streaming.StreamJob: getLocalDirs(): [/app/hadoop/tmp/mapred/local ] 08 [... ] INFO streaming.StreamJob: Running job: job_200803031615_0021 09 [... ] 10 [... ] INFO streaming.StreamJob: map 0% reduce 0% 11 [... ] INFO streaming.StreamJob: map 43% reduce 0% 12 [... ] INFO streaming.StreamJob: map 86% reduce 0% 13 [... ] INFO streaming.StreamJob: map 100% reduce 0% 14 [... ] INFO streaming.StreamJob: map 100% reduce 33% 15 [... ] INFO streaming.StreamJob: map 100% reduce 70% 16 [... ] INFO streaming.StreamJob: map 100% reduce 77% 17 [... ] INFO streaming.StreamJob: map 100% reduce 100% 18 [... ] INFO streaming.StreamJob: Job complete: job_200803031615_0021 19 [... ] INFO streaming.StreamJob: Output: /user/hduser/gutenberg-output 20 hduser@ubuntu:/usr/local/hadoop $ 从上面的输出可以看到,Hadoop还为一些统计信息提供了一个基本的网页接口。在Hadoop集群运行时可以打开 http://localhost:50030 查看HDFS路径/user/hduser/gutenberg-output上的文件 你可以通过 dfs -cat命令查看输出文件的内容 01 hduser@ubuntu:/usr/local/hadoop $ bin/hadoop dfs -cat /user/hduser/gutenberg-output/part-00000 02 "(Lo)cra" 1 03 "1490 1 04 "1498, " 1 05 "35 " 1 06 "40, " 1 07 "A 2 08 "AS-IS". 2 09 "A_ 1 10 "Absoluti 1 11 [... ] 12 hduser@ubuntu:/usr/local/hadoop $ 注意上面截图中单词两边的双引号并不是Hadoop自己加上去的,而是python程序将单词分割后生成的,不信的话可以查看完整的输出文件。 使用python的迭代器和生成器改进mapper和reducer代码 上面的例子应该让你明白了怎样构建一个MapReduce应用,不过上面那些代码侧重于易读性,特别是针对Python程序员新手。然而,在真实的应用中,你可能需要使用Python的迭代器和生成器来优化你的代码。 一般来说,迭代器和生成器(产生迭代的函数,比如包含yield输出语句)的优点是只有在你需要使用一个序列的元素时它才会生成该元素。这对于计算量很大或者内存开销很大的任务来说是很有用的。 注意,下面的Map和Reduce脚本只有在Hadoop的环境下才能正常运行,也就是说使用本地的命令“cat Data | ./mapper.py |sort -k1,1 |./reucer.py”并不会正常运行,因为有些函数特性在不能离开Hadoop mapper.py 01 #!/usr/bin/env python 02 """A more advanced Mapper, using Python iterators and generators.""" 03 04 import sys 05 06 def read_input( file ): 07 for line in file : 08 # split the line into words 09 yield line . split() 10 11 def main( separator = ' \t ' ): 12 # input comes from STDIN (standard input) 13 data = read_input( sys . stdin) 14 for words in data : 15 # write the results to STDOUT (standard output); 16 # what we output here will be the input for the 17 # Reduce step, i.e. the input for reducer.py 18 # 19 # tab-delimited; the trivial word count is 1 20 for word in words : 21 print ' %s%s%d ' % ( word , separator , 1) 22 23 if name == "main" : 24 main() reducer.py 01 #!/usr/bin/env python 02 """A more advanced Reducer, using Python iterators and generators.""" 03 04 from itertools import groupby 05 from operator import itemgetter 06 import sys 07 08 def read_mapper_output( file , separator = ' \t ' ): 09 for line in file : 10 yield line . rstrip() . split( separator , 1) 11 12 def main( separator = ' \t ' ): 13 # input comes from STDIN (standard input) 14 data = read_mapper_output( sys . stdin , separator = separator) 15 # groupby groups multiple word-count pairs by word, 16 # and creates an iterator that returns consecutive keys and their group: 17 # current_word - string containing a word (the key) 18 # group - iterator yielding all ["<current_word>", "<count>"] items 19 for current_word , group in groupby( data , itemgetter( 0 )): 20 try : 21 total_count = sum( int( count) for current_word , count in group) 22 print " %s%s%d " % ( current_word , separator , total_count) 23 except ValueError : 24 # count was not a number, so silently discard this item 25 pass 26 27 if name == "main" : 28 main()
游客2q7uranxketok 2021-02-22 13:27:10 0 浏览量 回答数 0

回答

您可以这样做: if [[ " ${arr[*]} " == " d " ]]; then echo "arr contains d" fi 例如,如果您查找“ a b”,这将产生误报-该子字符串在连接的字符串中,但不作为数组元素。无论您选择哪种定界符,都会出现此难题。 最安全的方法是遍历数组直到找到元素: array_contains () { local seeking=$1; shift local in=1 for element; do if [[ $element == "$seeking" ]]; then in=0 break fi done return $in } arr=(a b c "d e" f g) array_contains "a b" "${arr[@]}" && echo yes || echo no # no array_contains "d e" "${arr[@]}" && echo yes || echo no # yes 这是一个“更干净”的版本,您只需传递数组名称,而不是传递其所有元素 array_contains2 () { local array="$1[@]" local seeking=$2 local in=1 for element in "${!array}"; do if [[ $element == "$seeking" ]]; then in=0 break fi done return $in } array_contains2 arr "a b" && echo yes || echo no # no array_contains2 arr "d e" && echo yes || echo no # yes 对于关联数组,有测试一个非常整洁的方式,如果该数组包含一个给定的关键:在-v运营商 $ declare -A arr=( [foo]=bar [baz]=qux ) $ [[ -v arr[foo] ]] && echo yes || echo no yes $ [[ -v arr[bar] ]] && echo yes || echo no no 请参见手册中的6.4 Bash条件表达式。
保持可爱mmm 2020-02-10 16:06:28 0 浏览量 回答数 0

云产品推荐

上海奇点人才服务相关的云产品 小程序定制 上海微企信息技术相关的云产品 国内短信套餐包 ECS云服务器安全配置相关的云产品 开发者问答 阿里云建站 自然场景识别相关的云产品 万网 小程序开发制作 视频内容分析 视频集锦 代理记账服务