Loading [MathJax]/jax/output/CommonHTML/config.js
社区首页 >问答首页 >Python显示精简

Python显示精简
EN

Code Review用户
提问于 2020-01-27 14:37:41
回答 3查看 129关注 0票数 7

我为我制作的智能镜子设计了一个基本界面。我将其编码为包括时间、日期和每24小时刷新一次的几个短语。这些短语只是一些随机引用的例子。

我想知道是否有任何方法,我可以简化这段代码,甚至改进界面的布局。

代码语言:javascript
代码运行次数:0
复制
import tkinter as tk
import sys
import time
import calendar
import random
import datetime as dt
from tkinter import *

# Root is the name of the Tkinter Window. This is important to remember.
root=tk.Tk()

""" DICTIONARY PHRASES """
phrases = ["       I never had a policy; I have just tried to do my very best each and every day. -- Abraham Lincoln",
"      There are some things you learn best in calm, and some in storm. -- Willa Cather",
"       If a man does his best, what else is there? -- George S. Patton"]


class Clock(tk.Label):
    """ Class that contains the clock widget and clock refresh """

    def __init__(self, parent=None, seconds=True, colon=False):
        """
        Create and place the clock widget into the parent element
        It's an ordinary Label element with two additional features.
        """
        tk.Label.__init__(self, parent)

        self.display_seconds = seconds
        if self.display_seconds:
            self.time     = time.strftime('%I:%M:%S %p')
        else:
            self.time     = time.strftime('%I:%M:%S %p').lstrip('0')
        self.display_time = self.time
        self.configure(text=self.display_time, width=11)

        if colon:
            self.blink_colon()

        self.after(200, self.tick)


    def tick(self):
        """ Updates the display clock every 200 milliseconds """
        if self.display_seconds:
            new_time = time.strftime('%I:%M:%S %p')
        else:
            new_time = time.strftime('%I:%M:%S %p').lstrip('0')
        if new_time != self.time:
            self.time = new_time
            self.display_time = self.time
            self.config(text=self.display_time)
        self.after(200, self.tick)


    def blink_colon(self):
        """ Blink the colon every second """
        if ':' in self.display_time:
            self.display_time = self.display_time.replace(':',' ')
        else:
            self.display_time = self.display_time.replace(' ',':',1)
        self.config(text=self.display_time)
        self.after(1000, self.blink_colon)



class FullScreenApp(object):
    def __init__(self, master, **kwargs):
        self.master=master
        pad=3
        self._geom='200x200+0+0'
        master.geometry("{0}x{1}+0+0".format(
            master.winfo_screenwidth()-pad, master.winfo_screenheight()-pad))
        master.bind('<Escape>',self.toggle_geom)            
    def toggle_geom(self,event):
        geom=self.master.winfo_geometry()
        print(geom,self._geom)
        self.master.geometry(self._geom)
        self._geom=geom

def phrase_refresh():
    new_phrase = random.choice(phrases)
    e.configure(text=new_phrase, wrap=650) # e is your label
    root.after(86400, phrase_refresh) # Delay measured in milliseconds. Currently set to 24 hours. (There are 86400 milliseconds in a day)
    return new_phrase

# Sets background color to black
root.configure(bg="black")

# Removes the window bar at the top creating a truely fullscreen
root.wm_attributes('-fullscreen','true')
tk.Button(root, text="", bg="black", fg="black", command=lambda root=root:quit(root)).pack()

#Spacer
v = Label(root, text="", fg="white", bg="black")
v.pack(anchor=NW)

# this displays the clock known as clock1
clock1 = Clock(root)
clock1.pack(anchor=NW)

# This gives the clock format.
clock1.configure(bg='black',fg='white',font=("helvetica",60))

# Add the date to the tkinter window
w = Label(root, text=f"{dt.datetime.now():%a, %b %d %Y}", fg="white", bg="black", font=("helvetica", 30), width=16)
w.pack(anchor=NW)

#Spacer
s = Label(root, text="", fg="white", bg="black")
s.pack(anchor=NW)

#Spacer
p = Label(root, text="", fg="white", bg="black")
p.pack(anchor=NW)


# Add the phrase to the tkinter window
e = Label(root, fg="white", bg="black", font=("helvetica", 17))
phrase_refresh()
e.pack(anchor=NW)


root.mainloop()
EN

回答 3

Code Review用户

发布于 2020-01-31 22:41:57

以下是一些评论:

消除额外/未使用的进口

最好是从文件(或从“每日引用”网站(RSS提要))中加载引号。这样,您就不必编辑源代码来添加新的源了。

没有必要做一个单独的时钟类。这似乎使事情复杂化了。下面的代码在回调计时器上有一个函数。它“超过样本”的时间为每秒5倍。当第二天(可能是任何事情)发生变化时,将调用一个函数来更新时间/日期/短语。

时间格式显示秒,无论display_seconds是真是假。

没有使用类FullScreenApp。

这是我对展示部分的看法。从文件或URL中获取引号对读者来说是一项练习:

代码语言:javascript
代码运行次数:0
复制
import datetime
import random

import tkinter as tk

MESSAGE_WIDTH = 400
SHOW_SECONDS = False
BLINK_COLON = True

""" DICTIONARY PHRASES """
phrases = [
    "I never had a policy; I have just tried to do my very best each and every day. -- Abraham Lincoln",
    "There are some things you learn best in calm, and some in storm. -- Willa Cather",
    "If a man does his best,\n what else is there? -- George S. Patton",
    "Better to write for yourself and have no public, than to write for the public and have no self. -- Cyril Connolly",
    "Life is far too important a thing ever to talk seriously about. -- Oscar Wilde",
    "Indeed, history is nothing more than a tableau of crimes and misfortunes. -- Voltaire",
    "In great affairs men show themselves as they wish to be seen; in small things they show themselves as they are. -- Nicholas Chamfort",
    "The first step to getting the things you want out of life is this: Decide what you want. -- Ben Stein",
    "Life is what happens to you while you're busy making other plans. -- John Lennon",
    "For four-fifths of our history, our planet was populated by pond scum. -- J. W. Schopf",
    "History will be kind to me for I intend to write it. -- Sir Winston Churchill",
    "History is the version of past events that people have decided to agree upon. -- Napoleon Bonaparte",
    "You create your opportunities by asking for them. -- Patty Hensen",
    "If everyone had a dad like mine, no one would have sex tapes. -- Tina Fey"
    ]

root = tk.Tk()
root.configure(bg="black")

prev_time = datetime.datetime(1,1,1)

time_display = tk.StringVar(root, " "*len(" HH:MM:SS PM "))
date_display = tk.StringVar(root, " "*len("aaa, bbb dd, YYYY"))
phrase_display = tk.StringVar(root, " "*len(max(phrases, key=len)))
author_display = tk.StringVar(root, " "*MESSAGE_WIDTH)

def tick():
    global prev_time

    curr_time = datetime.datetime.now()

    if curr_time.second != prev_time.second:
        update_time(curr_time)

    if curr_time.second//15  != prev_time.second//15:    # this is for testing, it makes the quote update every 15 seconds
#    if curr_time.day != prev_time.day:                  # normally use this one to update quote every day
        update_phrase()

    if curr_time.day != prev_time.day:
        update_date(curr_time)

    prev_time = curr_time

    root.after(200, tick)


def update_date(curr_time):
    date_display.set(f"{curr_time:%a, %b %d, %Y}")


def update_phrase():
    phrase, author = random.choice(phrases).split('--')                              
    phrase_display.set(phrase.strip())
    author_display.set(f"-- {author.strip()}")


def update_time(curr_time):
    #       colon            no colon 
    fmt=[["   %H:%M %p  ", "   %H %M %p  "],        # without seconds
         [" %H:%M:%S %p ", " %H %M %S %p "]      # with seconds
        ][SHOW_SECONDS][BLINK_COLON and curr_time.second % 2]

    time_display.set(f"{curr_time:{fmt}}")


# Removes the window bar at the top creating a truely fullscreen
#root.wm_attributes('-fullscreen','true')
tk.Button(root, text="quit", bg="black", fg="red", command=root.quit).pack()

#Spacer
tk.Label(root, text="", fg="white", bg="black").pack()

# this displays the clock known as clock
clock = tk.Label(root, textvariable=time_display, bg='black',fg='white',font=("helvetica",60))
clock.pack()

# Add the date to the tkinter window
date = tk.Label(root, textvariable=date_display, fg="white", bg="black", font=("helvetica", 30), width=16)
date.pack()

#double height Spacer
tk.Label(root, text="\n\n", fg="white", bg="black").pack()

# Add the phrase to the tkinter window
text = tk.Message(root, textvariable=phrase_display, fg="white", bg="black", font=("helvetica", 17), width=400, justify="left")
text.pack()

author = tk.Message(root, textvariable=author_display, fg="white", bg="black", font=("helvetica", 17), width=400, justify='right', anchor='e')
author.pack()

#Spacer
tk.Label(root, text="", fg="white", bg="black").pack()

# starts the clock
tick()

root.mainloop()

# In some developement environments root.quit doesn't fully destroy the application; hence
# the call to root.destroy().  But clicking the close button (the 'X') on a window does destroy
# the application, so calling root.destroy() raises a TclError for trying to destroy it a
# second time.  This quiets the error message. 
try:
    root.destroy()
except tk.TclError:
    pass
票数 4
EN

Code Review用户

发布于 2020-02-01 18:36:08

恭喜你写了一个tk程序。他们可能很难。

将代码从顶层移出是可以在任何程序中进行的改进。顶层代码创建全局变量,使下面可能使用的内容不清楚,依此类推。你可以这么做:

代码语言:javascript
代码运行次数:0
复制
def main():
    # Sets background color to black
    root.configure(bg="black")
    ...
        except tk.TclError:
            pass

main()

这可能看起来很小,但它使我们更容易看到roottime_display和其他方面是全球性的,但author却不是。

一次只修一次。继续攻击!记笔记。

票数 4
EN

Code Review用户

发布于 2020-02-21 07:12:56

开局不错,但有几件事应该清理干净。

试着遵循一个标准。最好是PEP8。在=之间有额外的间隔,而在某些地方,,之间没有间隔,而且它很混乱。

  1. 删除from tkinter import *这是出于两个原因。首先,您已经在执行import tkinter as tk,因此不需要第二次导入tkinter。如果导入的名称重叠并被覆盖,两个import *可能会导致问题。
  2. 删除未使用的导入。艾尔:日历雷达
  3. 修正清理格式以遵循PEP8。方法之间的单空间,函数/类之间的双空间,等等。
  4. 删除不必要的/多余的注释。注释应该用于解释代码中不明显的内容。
  5. 您可以编写两次tick代码。一次在__init__,一次在tick。您可以删除__init__中的实例,只需立即调用tick,同时在init中为self.timeself.display_time添加一个默认值。
  6. 在after语句中使用200毫秒。这比你需要的要多5倍。每隔1秒就够了。不需要调用该函数比所需的多5倍。
  7. 从未使用过类FullScreenApp。所以要么在某个地方实现它,要么把它移除。
  8. 你的return in phrase_refresher对你没有任何帮助。它返回到一个没有变量赋值的调用,然后它将永远返回到它自己。您可以删除返回。
  9. 退出按钮不需要一个lambda。可以保存要退出的引用。
  10. 退出按钮没有单词,与背景颜色相同。这将使它非常适合某人点击它:D
  11. 您已经从tk.Label继承了,那么为什么不对根窗口也这样做呢?
  12. 最后,您不需要间隔标签。您可以使用padxpady来确定小部件之间的间距。

参见下面的返工示例。如果你有任何问题,请告诉我。

代码语言:javascript
代码运行次数:0
复制
import tkinter as tk
import datetime as dt
import random
import time

phrases = ["       I never had a policy; I have just tried to do my very best each and every day. -- Abraham Lincoln",
           "       There are some things you learn best in calm, and some in storm. -- Willa Cather",
           "       If a man does his best, what else is there? -- George S. Patton"]


class Clock(tk.Label):
    """ Class that contains the clock widget and clock refresh """

    def __init__(self, parent=None, seconds=True, colon=False):
        """
        Create and place the clock widget into the parent element
        It's an ordinary Label element with two additional features.
        """
        tk.Label.__init__(self, parent, width=11)
        self.display_seconds = seconds
        self.time = None
        if colon:
            self.blink_colon()
        self.tick()

    def tick(self):
        """ Updates the display clock every 200 milliseconds """
        if self.display_seconds:
            new_time = time.strftime('%I:%M:%S %p')
        else:
            new_time = time.strftime('%I:%M:%S %p').lstrip('0')
        print(new_time)
        if self.time is not None:
            if new_time != self.time:
                self.time = new_time
                self.display_time = self.time
                self.config(text=self.display_time)
        else:
            self.time = new_time
        self.after(1000, self.tick)

    def blink_colon(self):
        """ Blink the colon every second """
        if ':' in self.display_time:
            self.display_time = self.display_time.replace(':', ' ')
        else:
            self.display_time = self.display_time.replace(' ', ':', 1)
        self.config(text=self.display_time)
        self.after(1000, self.blink_colon)


class App(tk.Tk):
    def __init__(self):
        super().__init__()
        self.configure(bg="black")
        self.wm_attributes('-fullscreen', 'true')
        tk.Button(self, text="Quit", bg="black", fg="white", command=self.quit).pack()

        clock1 = Clock(self)
        clock1.configure(bg='black', fg='white', font=("helvetica", 60))

        w = tk.Label(self, text=f"{dt.datetime.now():%a, %b %d %Y}",
                     fg="white", bg="black", font=("helvetica", 30), width=16)
        clock1.pack(anchor='nw', pady=(25, 0))
        w.pack(anchor='nw', pady=(0, 30))

        self.e = tk.Label(self, fg="white", bg="black", font=("helvetica", 17))
        self.phrase_refresh()
        self.e.pack(anchor='nw')

    def phrase_refresh(self):
        new_phrase = random.choice(phrases)
        self.e.configure(text=new_phrase, wrap=650)
        self.after(86400, self.phrase_refresh)


App().mainloop()

最后,我不确定你是否想让计时器在左上角。从你的全屏判断,我猜你想要以它为中心。为此,我更倾向于使用grid() over pack(),因为网格允许我们为行和列设置权重,从而使IMO更容易对所有内容进行居中。

参见此示例:

代码语言:javascript
代码运行次数:0
复制
import tkinter as tk
import datetime as dt
import random
import time


phrases = ["I never had a policy; I have just tried to do my very best each and every day. -- Abraham Lincoln",
           "There are some things you learn best in calm, and some in storm. -- Willa Cather",
           "If a man does his best, what else is there? -- George S. Patton"]


class Clock(tk.Label):
    """ Class that contains the clock widget and clock refresh """
    def __init__(self, parent=None, seconds=True, colon=False):
        """
        Create and place the clock widget into the parent element
        It's an ordinary Label element with two additional features.
        """
        tk.Label.__init__(self, parent, width=11)
        self.display_seconds = seconds
        self.time = None
        if colon:
            self.blink_colon()
        self.tick()

    def tick(self):
        """ Updates the display clock every 200 milliseconds """
        if self.display_seconds:
            new_time = time.strftime('%I:%M:%S %p')
        else:
            new_time = time.strftime('%I:%M:%S %p').lstrip('0')
        print(new_time)
        if self.time is not None:
            if new_time != self.time:
                self.time = new_time
                self.display_time = self.time
                self.config(text=self.display_time)
        else:
            self.time = new_time
        self.after(1000, self.tick)

    def blink_colon(self):
        """ Blink the colon every second """
        if ':' in self.display_time:
            self.display_time = self.display_time.replace(':', ' ')
        else:
            self.display_time = self.display_time.replace(' ', ':', 1)
        self.config(text=self.display_time)
        self.after(1000, self.blink_colon)


class App(tk.Tk):
    def __init__(self):
        super().__init__()
        self.configure(bg="black")
        self.wm_attributes('-fullscreen', 'true')
        self.columnconfigure(0, weight=1)
        self.rowconfigure(1, weight=1)

        tk.Button(self, text="Quit", bg="black", fg="white", command=self.quit).grid(row=0, column=0)

        frame = tk.Frame(self, bg="black")
        frame.grid(row=1, column=0)

        clock1 = Clock(frame)
        clock1.configure(bg='black', fg='white', font=("helvetica", 60))

        w = tk.Label(frame, text=f"{dt.datetime.now():%a, %b %d %Y}",
                     fg="white", bg="black", font=("helvetica", 30), width=16)
        clock1.grid(row=2, column=0, pady=(25, 0))
        w.grid(row=3, column=0, pady=(0, 30))

        self.e = tk.Label(frame, fg="white", bg="black", font=("helvetica", 17))
        self.phrase_refresh()
        self.e.grid(row=6, column=0)

    def phrase_refresh(self):
        new_phrase = random.choice(phrases)
        self.e.configure(text=new_phrase, wrap=650)
        self.after(86400, self.phrase_refresh)


App().mainloop()
票数 3
EN
页面原文内容由Code Review提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://codereview.stackexchange.com/questions/236257

复制
相关文章
jq精简显示(隐藏)文本
全栈若城
2024/02/29
960
jq精简显示(隐藏)文本
精简Python项目的Dockerfile
之前生成的镜像很大,1个G。因为公司的需求是要将所有的代码,配置文件都放到Docker中,并且程序只保留编译过后的pyc文件。也就是说,给客户的是一个Docker镜像 而且Docker镜像是禁止客户访问的,数据库配置信息咋办?这些全部写在了.env的配置文件里,也方便客户去修改操作,然后用docker-compose中的env-file指定一下文件就ok了,但是就算这样,将项目一股脑的塞到一起,不大才怪咧。经过两天的研究,最终将项目精简到了380MB。应该是可以在减少 但是先这样。。记录一下吧 ---- 从
简单、
2018/07/17
1.4K0
Python 代码精简和优化
Python很简单,容易使用,开发效率很高,移植性很好,代码资源也很丰富,被广泛使用。但是Python代码编出来的动态库比较大,python库很全,缺点就是库比较大。
py3study
2020/01/06
1.5K0
Python精简代码实现循环左移循环右移
循环左移原理 拿一个32位的数(4个字节)来说 进行移动八位 如: 0x12345678 rol 8 之后 = 0x34567812 其原理如下: 1.首先左移八位得到 0x345678 2.然后右移24位得到 0x12 最后 0x345678 | 0x12 = 0x34567812 鉴于Python的特殊性.我们只需要32bit数即可. 也就是最后要 & 0xFFFFFFFF 其它移位同理
IBinary
2020/12/22
2.3K0
python『学习之路01』python 购物车精简版
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2017/11/17 1:52 # @Author : mixiu26 # shopping.py public_list = [ ("iphone",5800), ("Mac Book",11800), ("Bike",1200), ("Wtach",10600), ("Coffee",31), ("Book",66) ] Shopping_list = [] Salary = input("Input your salary: ") if Salary.isdigit(): salary = int(Salary) while True: for item in public_list: print(public_list.index(item),item) # index --- >返回指定元素索引 user_choice = input("请选择您需要的商品 >>>>: ") if user_choice.isdigit(): choice = int(user_choice) if choice >=0 and choice < len(public_list): p_item = public_list[choice] if p_item[1] <= salary: Shopping_list.append(p_item) # 余额扣款: salary -= p_item[1] print("Add %s into shppoing cart, your current balance is \033[31;1m%s\033[0m" %(p_item,salary)) else: print("\033[41;1m你的余额仅剩[%s], 请充值: \033[0m" % salary) else: print("The Product code [%s] your Input is not exist! " % choice) elif user_choice == "q": print("===================== shopping list ========================") for i in Shopping_list: print(i) print("Your current balance: ",salary) exit() else: print("没有查到当前编号对应的商品信息, 请重新输入: ") else: print("没有查到当前编号对应的商品信息, 已退出")
呆呆
2021/05/18
3800
Docker精简项目(Python3.6+Flask1.0+Pipenv)
项目采用最新版本的Flask和现在流行的Pipenv,virtualenv因为配置过程,使用过程都会遇到一些不小的麻烦,所以推荐使用pipenv来管理自己的项目环境。 引入的bigdata镜像里面,我已经封装好了supervisor、gunicorn、nginx,所以配置好nginx.conf和supervisor.conf即可 Dockerfile FROM registry.cn-hangzhou.aliyuncs.com/littleseven/bigdata # 根据我的基础镜像又封装的一个新的镜像
简单、
2018/07/18
1.6K6
手把手教你python画图(精简实例,一
1、不叨叨,直接上代码 import matplotlib.pyplot as plt x = [1,2,3,4,5] y = [0,3,2,7,9] plt.figure() plt.plot(
py3study
2020/01/06
4430
python 显示地图
之前写了一篇, 有份近10年的地震数据,你会怎样用python分析呢? 有人留言说,想要将数据显示地图上。 比如地震网上这种效果。 显示图表的库非常多,这里我们试用一个轻量级第三方 folium 库。 三行代码就可以在本地生成一个render.html地图网页文件。 import folium world_map = folium.Map(location=[28.5, 100.40], zoom_start=4) world_map.save('render.html') 详细使用可以查看其文档。
叶子陪你玩
2022/05/22
1.2K0
python 显示地图
Vuex精简文档
Vuex 通过 store 选项,提供了一种机制将状态从根组件“注入”到每一个子组件中(需调用 Vue.use(Vuex)):
神葳
2021/01/22
8640
Redis 精简笔记
Redis 是用 C 语言开发的一个开源的高性能键值对(key-value)数据库,官方提供测试数据,50 个并发执行 100000 个请求,读的速度是 110000 次/s,写的速度是 81000 次/s ,且 Redis 通过提供多种键值数据类型来适应不同场景下的存储需求,目前为止 Redis 支持的键值数据类型如下:
迷路的朱朱
2023/04/30
7190
Python3 | 练气期,入门精简基础语法!
前面我们已经尝试了Python程序的几种运行方式,并运行了第一个Hello World的Python程序,并且列举了 Python2 与 Python3 的部分差异!
全栈工程师修炼指南
2024/07/16
1440
Python3 | 练气期,入门精简基础语法!
OpenCv库的精简
cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=..\..\android\android.toolchain.cmake ..\..\..
jerrypxiao
2021/02/22
2.8K0
前端基础精简总结
ES5: String、Number、Boolean、Null、Undefined、Object ES6增: Symbol 其中,object为引用,其他为基本类型
超然
2018/09/27
1.7K0
前端基础精简总结
Python画图显示中文
matplotlib作图时默认设置下为英文,无法显示中文,只需要添加下面两行代码即可
全栈程序员站长
2022/09/05
1.4K0
显示python库路径
[root@localhost doc]# python -c “import sys;print sys.path” ['', '/usr/lib/python24.zip', '/usr/lib/python2.4', '/usr/lib/python2.4/plat-linux2', '/usr/lib/python2.4/lib-tk', '/usr/lib/python2.4/lib-dynload', '/usr/lib/python2.4/site-packages', '/usr/lib/python2.4/site-packages/Numeric', '/usr/lib/python2.4/site-packages/gtk-2.0']
py3study
2020/01/07
1.7K0
PYTHON之显示居中
把字体显示在屏幕的中间 sentence = raw_input("Sentence:") screen_width = 80text_width = len(sentence)box_width = text_width + 6left_margin = (screen_width - box_width) // 2 printprint ' '*left_margin + '+' + '-'*(box_width) + '+'print ' '*(left_margin+2) + '| ' + ' '*
py3study
2020/01/06
9360
Java 代码精简之道
其中:“道”指“规律、道理、理论”,“术”指“方法、技巧、技术”。意思是:“道”是“术”的灵魂,“术”是“道”的肉体;可以用“道”来统管“术”,也可以从“术”中获得“道”。
JAVA葵花宝典
2020/06/04
2.1K0
jmeter组件精简概述
jmeter是基于java语言的压力测试工具,除了通过命令来执行压测脚本,还提供图形界面功能。用户在图形界面中可以设置“测试计划”、“线程组”、“取样器”、“逻辑控制器”、“定时器”、“配置项”、“断言”、“变量”、“观察结果树”、“结果报表”、“结果图”。一开始接触这个工具时就感觉好多名词,记一遍忘一遍,忘一遍再记一遍。为了理清思路,我们可以从测试用例四大要素:条件、输入、执行、预期结果,来理解这些组件。先准备好条件和输入,然后执行测试,当实际结果与预期结果一致时,测试用例通过。正所谓万变不离其宗。
Criss@陈磊
2020/02/14
8940
jmeter组件精简概述
Python高频写法总结:精简代码,提高效率
今天为大家分享 Python高频写法总结:精简代码,提高效率,全文3400字,阅读大约12分钟。
老表
2023/12/13
3200
Python高频写法总结:精简代码,提高效率
虚拟目录+认证精简
NameVirtualHost 172.16.1.15:80 <VirtualHost 172.16.1.15:80> ServerName www.jnds.net DocumentRoot /var/www/html Alias /en "/data/CN" <Directory "data/CN"> AuthType Basic AuthName "test" AuthUserFile /etc/httpd/.htpasswd require user
呆呆
2021/05/17
1.2K0

相似问题

精简Javascript MomentJS函数

10

精简一系列除了+if以外的尝试语句,以加快Python的循环处理。

10

用于SFML的精简程序流的小型库

20

我能精简这个UTF8 8编码程序吗?

40

在Python窗口中显示多个视频

10
添加站长 进交流群

领取专属 10元无门槛券

AI混元助手 在线答疑

扫码加入开发者社群
关注 腾讯云开发者公众号

洞察 腾讯核心技术

剖析业界实践案例

扫码关注腾讯云开发者公众号
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
查看详情【社区公告】 技术创作特训营有奖征文