nginx-status 相关问题


Docker 镜像 NGINX 未公开:无法访问站点

1。我正在使用本指南来获取要运行的 nginx 网络服务器映像并使用命令 docker run -p 8888:80 nginx docker run -p 80:80 nginx 我猜有两个或更多容器启动并运行......


Nginx 无法通过index.html 提供媒体服务

我对 Nginx 还很陌生。我想要实现的是使用它的 Docker 映像来为我的网页(及其所有媒体)提供服务。 我的项目结构: 。 ├── nginx │ ├──conf.d │ └── nginx.conf └── w...


Nginx + Express - 从 Docker 容器提供静态文件

我在 Docker 容器中有一个 Express api 和一个 Nginx。我希望 Nginx 反向代理对 API 的常规请求,但我希望它直接提供图像等静态文件。 但我...


Nginx:在重定向期间保留端口

我有一个 Nginx 服务器监听在 Docker 容器内运行的 80。 在 Nginx 配置中,我需要在特定情况下执行到静态页面的重定向。 重写 ^ /foobar.html 重定向...


在 nginx 入口中打开 TCP 连接

我在通过 nginx-ingress 打开 TCP 连接时遇到问题。 所以我的目标是我想在我的 Kubernetes 集群上使用 Nginx-Ingress 在端口 9000 上打开 Clickhouse TCP 连接。 到目前为止,我可以...


如果 markdown frontmatter 中的值(对于博客文章)键:值对是特定字符串,则运行 git hook

我有一个 git hook 预提交,如果文件在我的 AstroPaper 博客中被修改,它会更新 modDatetime。 # 修改文件,更新modDatetime git diff --cached --name-status | git diff --cached --name-status | git diff --cached --name-status | egrep -i &q...


Nginx 入口控制器 - 无法使用主机名访问 AKS Azure 负载均衡器

我有一个私有 AKS 集群,并且正在使用 nginx 入口控制器。到目前为止,我已经做了以下事情。 安装 nginx 入口控制器 命名空间=jananath-test helm 升级 --安装 ingress-n...


NGINX 请求转发时使用美元符号 URL

我想设置NGINX,以便所有以下形式的请求: example.com/$ example.com/$/ example.com/$/a example.com/$/a/ example.com/$/a/b/ 被转发到一台上游服务器,其他一切都是


在Rails中,如果枚举有空格,有没有办法访问其查询快捷方法?

我有一个带有名为“status”的枚举属性的模型。其中一个值(“进行中”)有一个空格。 班级游戏 < ApplicationRecord enum status: [:scheduled, :"in pro...


Nginx无限文件上传

当我尝试将文件上传到我的服务器时,我得到无限上传。不过,上传文件效果很好。 我的/etc/nginx/nginx.conf: 用户www-数据; 自动worker_processes; pid /run/nginx.pid; 包括/etc/


Nginx 和 Traefik 的性能非常慢

我们有以下基础设施来部署 PHP 应用程序: 运行 Nginx 作为代理的 VM Docker Swarm 集群中有 3 个节点 Traefik 容器部署在这个集群中(所以我们有 3 个包含...


如果请求与路径不匹配,如何让 Nginx 返回 444?

简短版本: 我想使用 NGINX 作为反向代理,以便访问面向公众的 URL 的客户端从代理后面的内部 Gunicorn 服务器获取 API 数据: 外部PA...


Nginx 安全链接和 java

我有一个项目,我需要从我的服务器流式传输视频,我使用 nginx 来完成它,还使用 spring mvc 开发的 webapp 和 tomcat 来包含它。 怎么运行的: java应用程序制作md5哈希...


错误 | prefect.flow_runs.runner - 流程运行进程退出,状态代码:-7

我在运行脚本时收到此完美错误。错误如下: 0%| | 0/2070 [00:00 我在运行脚本时收到此完美错误。错误如下: 0%| | 0/2070 [00:00<?, ?it/s]09:36:01.917 | ERROR | prefect.flow_runs.runner - Process for flow run 'auspicious-butterfly' exited with status code: -7 09:36:02.057 | INFO | prefect.flow_runs.runner - Reported flow run '1f314ccd-1472-4373-bb1b-4b3b6265b29a' as crashed: Flow run process exited with non-zero status code -7. 不知道为什么。任何帮助将不胜感激。 我和 Prefect 也有同样的错误。您有什么版本的 Prefect? Reported flow run 'bbaa6e16-bf5f-44ff-a31b-d68645f74bb1' as crashed: Flow run process exited with non-zero status code -7. Process for flow run 'xi5-zeon' exited with status code: -7


Selenium 找不到标签

chrome 开发工具 我无法获取 xmp 标签或类“note”出现错误 我尝试过这些 # status = driver.find_element(By.CSS_SELECTOR, value=".msgdiv") 状态=司机。


本地主机上的 Nginx http 到 https 重定向出现页面重定向错误

我在 Ubuntu 中的 Nginx 本地主机上托管了一个简单的静态站点。但重定向代码给我错误“页面未正确重定向”。 提供问题的重定向代码是:


在 AKS 中使用 nginx 入口控制器,并使用工作负载身份从 Key Vault 中提取 TLS 证书终止

我正在将 AKS 与 nginx 入口控制器结合使用。 我正在使用包含 .key 和 .crt 的 kubernetes tls Secret 并将其引用到 ingress.yaml 中 Kubectl 创建秘密 tls $secret_name --key=...


如何在 istio ingress gateway 中配置以下 nginx 注解

如何在 istio ingress gateway 中添加以下 ssl-redirect 配置 nginx.ingress.kubernetes.io/ssl-redirect:“假” nginx.ingress.kubernertes.io/force-ssl-redirect:“假&...


使用 `ggsurvfit::ggsurvfit()` 绘制对数减对数图

是否可以使用 ggsurvfit::ggsurvfit() 生成对数减对数图? 这是我想要生成的示例: 库(ggsurvfit) 温度 <- survfit2(Surv(time, status) ~ adhere, data =


如何将 React Native 钩子调用移动到钩子?

这就是我的文件中的内容: const isInProgress = 进度?.status === 'IN_PROGRESS' ??错误的; 使用效果(()=> { 常量间隔 = setInterval(() => { 如果(正在进行中)...


程序接收信号SIGIO

我在 NGINX 的 error.log 中看到以下错误: [注意] 12451#0:收到信号29(SIGIO) 我想知道程序在什么情况下会收到 SIGIO?


如何删除 PROXMOX 集群?

我已经在 Ubuntu proxmox 节点(“node01”)上创建了一个集群 pvecm创建cluster1 这是 pvecm status 的输出(出于安全目的,我将 IP 地址更改为 1.1.1.1) 根@node01:~#


如何在异步C++客户端中获取gRPC状态

我正在使用 C++ 实现 gRPC 异步客户端,我需要获取服务器返回的 grpc-status 来进行错误处理,但 AsyncNext API 只返回与


自定义 Weblogic HTTP 扩展日志记录格式

当前在我的 weblogic 服务器中我已启用 HTTP 日志记录。以下是当前配置。 格式为“扩展”。 扩展日志格式字段为“日期时间 cs-method cs-uri sc-status time...


带有 nginx-proxy 的 Docker:不允许附加属性名称

从 ubuntu 18 升级到 Ubuntu 20.04.6 LTS 后 Docker 停止工作 我正在使用 docker-compose 但它完全停止工作。所以我切换到“docker compose” 我现在正在尝试...


子路径 URL 404 上的 Keycloak 运算符

我正在尝试使用 Operator 将 Keycloak 部署到 kubernetes 集群上。 我需要该应用程序存在于“/auth”而不是“/”上。 我正在使用 ingress-nginx 入口控制器并创建入口...


在 NodeJs Express 中让 SocketIO 在 HTTPS 上工作

大家好, 将我的 NodedJs 应用程序推送到我的 ubuntu 服务器(使用 https 在 nginx 中提供站点)后,我遇到了问题。在我使用 localhost 的本地环境中,连接是


Nginx 正则表达式如果 url 以单词结尾则返回 404

类似 /admin/somefile 的 URL?某些参数应该可以工作 像 /admin/somefile?someparameters#authorize 这样的 URL 应该返回 404 所以我在网址末尾寻找“#authorize” 现在我是


让 git status 显示未修改/未更改的跟踪文件?

这是一个简短的代码片段示例(您可以将其粘贴到 Linux 终端中),创建一个新的 git 存储库并向其中添加一些文件(使用 git 版本 1.7.9.5): cd /tmp/ mkdir myrepo_git 光盘


最新的 xcode 15.0.1 安装到 iphone 时卡住了 (2) <-- displays "2" to right of status message on top bar

突然,当我尝试在连接到 mac2 的 iphone 上运行我的 swift 应用程序时,xcode 顶部栏显示: “将 my_app 安装到 iPhone (2)” (2) 是一个灰色圆盘,里面有一个 2。 当我


如何指定 AWS 访问密钥 ID 和秘密访问密钥作为 amazon s3n URL 的一部分

我将输入和输出文件夹作为参数传递给来自网页的mapreduce字数统计程序。 出现以下错误: HTTP Status 500 - 请求处理失败;嵌套异常是 java.l...


后台应用程序间歇性工作

我们已经在AKS集群上部署了后台应用程序,并且我们的应用程序使用了nginx入口控制器,但是应用程序不稳定,它工作了2分钟,然后长时间宕机(


配置 SAML2:绕过“InResponseTo”验证,同时保留 OpenSaml4AuthenticationProvider 中的默认设置

我有一个在 Nginx 和 Spring Security 后面运行的 Java 后端应用程序用于 SSO。我的后端应用程序缺乏记住 cookie 会话的机制,因为 SSO 请求可能由...发起


带有 sum by(status) 的 Prometheus 查询尽管单个查询有效,但在组合查询中没有产生任何结果

我在 Prometheus 查询中遇到了一个特殊问题,即组合两个查询会导致没有数据,即使每个单独的查询都返回结果。目标是计算差异...


使用加密的 sudo_password.yml 自动执行 Ansible Playbook:安全处理 Vault 密码

我对ansible的其中一项功能感觉不太满意。 对于我的场景,我想在我的托管节点上执行一个剧本来安装例如 nginx。 现在我的控制节点上有以下 playbook.ym...


与 docker 容器上的 nginx 发生反应 - 不加载 App.tsx

我有一个反应应用程序 当我在本地运行它时,它可以正常工作 npm 运行开发 我想让我的 React 应用程序在本地和带有 docker 镜像的 aws 上运行 我创建了这个泊坞窗图像: #


我如何根据状态更改按钮颜色(绿色表示“接受”,红色表示“删除”)

如何根据状态更改按钮颜色(绿色表示“接受”,红色表示“删除”) 我是新人,为此使用 Laravel 框架。 这是我的观点 如何根据状态更改按钮颜色(绿色表示“接受”,红色表示“删除”) 我是新人,为此使用 Laravel 框架。 这是我的看法 <table class="table table-striped" id="example"> <thead> <tr> <th>ID no</th> <th>Form Name</th> <th style="text-align: center">Update</th> <th>Delete</th> <th>Status</th> </tr> </thead> @foreach($form as $show) {{--modal--}} <div class="modal fade mj_popupdesign mj_checkoutpopup" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-body"> <div class="col-lg-8 col-md-8 col-sm-12 col-xs-12 col-lg-offset-2 col-md-offset-2"> <div class="row"> <div class="mj_pricingtable mj_greentable mj_login_form_wrapper"> <form> <div class="mj_login_form"> <p>Are you sure you want to delete this post?</p> <br> <a href="" class="mj_btn btn btn-default pull-right glyphicon glyphicon-remove "> No</a> <a href="{{url('deleteForm',$show->id)}}" class=" pull-right mj_btn btn btn-danger glyphicon glyphicon-ok"> Yes</a> </div> </form> </div> </div> </div> </div> </div> </div> </div> {{--end modal--}} <tbody> <tr> <td> <p> {{$show->id}}</p> </td> <td> <h6><a href="{{url('JobDetails',$show->id)}}"style="color: rgb(0, 191, 243);font-size:18px;float: left;margin: 0;text-align: left">{{$show->jobTitle}}</a> </h6> <p> {{$show->created_at}} </p> </td> <td> <a href="{{url('UpdateFormView',$show->id)}}"> <span class="mj_btn btn btn-success">Update</span> </a> </td> <td> <span class="mj_btn btn btn-danger" data-toggle="modal" data-target="#myModal2">Delete</span> </td> <td><span class="mj_btn btn btn-warning">pending</span> </td> </tr> </tbody> @endforeach </table> </div> </div> </div> </div> 在我的控制器中public function AcquiredForm() { $acquired="Requirement Form"; $acquireForm=Job::where('jobType','LIKE','%'.$acquired.'%'); $form = $acquireForm->get(); return view('private-pages.company.aquire-form',compact('form')); } 数据库状态默认为待处理 数据库状态默认为pending 我在代码中没有看到 status 属性,但显示状态为待处理的纯字符串 <span class="mj_btn btn btn-warning">pending</span> <!-- while it suppose to be --> <span class="mj_btn btn btn-warning">{{ $show->status }}</span> 假设它确实存在,你可以做 <td> @if ($show->status === 'Accept') <span class="mj_btn btn btn-green">Accepted</span> @elseif ($show->status === 'Delete') <span class="mj_btn btn btn-danger">Deleted</span> @else <span class="mj_btn btn btn-warning">Pending</span> @endif </td> 参见:https://laravel.com/docs/5.1/blade#displaying-data <td> @if ($show->jobstatus === "Accepted") <span class="mj_btn btn btn-success">Accepted</span> @elseif ($show->jobstatus === "Rejected") <span class="mj_btn btn btn-danger">Rejected</span> @else <span class="mj_btn btn btn-warning">Pending</span> @endif </td> 或者当你使用 1. laravel esialy customaize this code nad add automatic refresh in the page to more interactive @php if($da->status == "requested") { echo "<td><button class='btn btn-primary'>Requested</button></td>"; } else { echo "<td><button class='btn btn-success'>Ordered</button></td>"; } @endphp


如何使用DomDocument通过id获取值?

我正在尝试使用 DomDocument 获取下面表单的值,但到目前为止仍然失败 我正在尝试使用 DomDocument 获取下面表单的值,但到目前为止仍然失败 <?php $string ='<form action="profile" method="post" enctype="multipart/form-data"> <input type="hidden" name="id_user" id="id_user" value="123"> <input type="hidden" name="logo" id="logo" value="path/to/logo1.png"> <input type="hidden" name="status" id="status" value="Ok"> <input type="submit" value="PROFILE"> </form>'; ?> 这种情况下如何正确使用DomDocument? 我正在尝试下面的代码 $dom = new DomDocument(); $dom->loadHTML($string); $dom->getElementById("id_user"); 我期望得到 123 作为返回值 DomDocument 有点麻烦,但如果您遵循文档,您就可以到达那里。我找到了这条路线: $dom->getElementById("id_user")->attributes->getNamedItem("value")->value 返回: 123 参见:https://onlinephp.io/c/c37dc 可能还有其他方法可以做到同样的事情。


如何从当前打开的 HTML 网站中的元素获取数据?

我发现自己需要深入研究开放网站的 HTML 代码,并从 标签获取一些数据,特别是其中的背景图像元素的值。这个元素改变... 我发现自己需要深入研究开放网站的 HTML 代码,并从 <div> 标签获取一些数据,特别是其中的 background-image 元素的值。该元素会根据页面上执行的操作而发生变化。现在我需要找出如何让我的代码从 Firefox 中打开的选项卡返回该特定元素的值。最简单的方法是什么? 我看了美丽汤,但我不知道还需要搭配什么。据我所知,它对于解析 HTML 数据很有用,但对于首先获取该数据却没有用。 您可以使用 requests 来获取页面的 HTML 内容,如下所示: import requests from bs4 import BeautifulSoup def scrape_website(url): # Send an HTTP request to the URL response = requests.get(url) # Check if the request was successful (status code 200) if response.status_code == 200: # Parse the HTML content of the page soup = BeautifulSoup(response.content, 'html.parser') # Extract data based on HTML structure (replace with your own logic) divs = soup.find_all('div') for div in divs: print(div.text) else: print(f"Failed to retrieve the page. Status code: {response.status_code}") 这里我们向站点发送一个 HTTP 请求,如果响应是 200(等于 ok ),我们将响应中的 HTML 数据发送到变量并使用 Beatiful Soup 解析它。您需要将解析代码更改为最适合您的代码,但此时您可以询问 Chat-GPT。


MatToolbar:尝试组合不同的工具栏模式

出现以下错误: MatToolbar:尝试组合不同的工具栏模式。显式指定多个 元素或仅将内容放置在 中 出现以下错误: MatToolbar:尝试组合不同的工具栏模式。要么显式指定多个 <mat-toolbar-row> 元素,要么仅将内容放置在单行的 <mat-toolbar> 中。 我的代码已经在 mat-toolbar 中应用了 mat-toolbar-row。然而,该错误仍然存在。 html文件的代码片段如下: <div class="wallpaper"> <mat-toolbar color="primary"> <mat-toolbar-row> <span>Welcome, User</span> <span class="example-fill-remaining-space"></span> <span class="align-center"></span> <span class="example-spacer"></span> <button mat-button>Create Incident </button> <a [routerLink]="['/closed']"><button mat-button style="color: white">Closed Incident</button></a> <span class="example-spacer"></span> <a [routerLink]="['/login']"><button mat-button>Logout</button></a> <img src="../../assets/hsbc_logo3.png" class="logo-hsbc"/> </mat-toolbar-row> <h1>INCIDENT MANAGEMENT SYSTEM</h1> </mat-toolbar> <h1>Welcome to Incident Management System</h1> <mat-card style="background: transparent"> <!-- Title of an Card --> <mat-card-title>Incident Details</mat-card-title> <mat-card-content> <form> <table > <tr> <td> <mat-form-field class="demo-full-width"> <mat-label >Description</mat-label> <textarea [(ngModel)]="incident.description" name="description" cdkTextareaAutosize cdkAutosizeMinRows="1" cdkAutosizeMaxRows="5" matInput></textarea> </mat-form-field> </td> <td> <h4>{{message}}</h4> </td> </tr> <tr> <td> <mat-form-field class="demo-full-width"> <input matInput [matDatepicker]="picker" placeholder="Incident Date" [(ngModel)]="incident.date" name="date" > <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle> <mat-datepicker touchUi="true" #picker></mat-datepicker> </mat-form-field> </td> </tr> <tr> <td colspan="2"> <mat-form-field class="demo-full-width"> <input matInput placeholder="Incident Category" [(ngModel)]="incident.category" name="category"> </mat-form-field> </td> </tr> <tr> <td > <mat-form-field class="demo-full-width"> <mat-select placeholder="Application Owner" [(ngModel)]="incident.owner" name="owner"> <mat-option style="background-color:grey">-- Select--</mat-option> <mat-option style="background-color:cornsilk" value="1">BRV</mat-option> <mat-option style="background-color:cornsilk" value="2">FRTB</mat-option> <mat-option style="background-color:cornsilk" value="3">FSA</mat-option> </mat-select> </mat-form-field> </td> <td> <mat-form-field> <mat-select placeholder="Symphony Group" [(ngModel)]="incident.symphony_group" name="symphony_group"> <mat-option style="background-color:grey">-- Select --</mat-option> <mat-option style="background-color:cornsilk" value="1">MMO SheHacks</mat-option> <mat-option style="background-color: cornsilk" value="2">MMO IT INDIA</mat-option> </mat-select> </mat-form-field> </td> </tr> <tr> <td> <mat-form-field> <mat-select placeholder="Application" [(ngModel)]="incident.application" name="application"> <mat-option style="background-color:grey">-- Select--</mat-option> <mat-option style="background-color:cornsilk" value="1">BRV</mat-option> <mat-option style="background-color:cornsilk" value="2">FRTB</mat-option> <mat-option style="background-color:cornsilk" value="3">FSA</mat-option> </mat-select> </mat-form-field> </td> <td> <mat-form-field> <mat-select placeholder="Status" [(value)]="status" [(ngModel)]="incident.status" name="status"> <mat-option style="background-color:grey">-- Select --</mat-option> <mat-option style="background-color: green" value="1">Available</mat-option> <mat-option style="background-color: orange" value="2">Reduced</mat-option> <mat-option style="background-color: red" value="3">Unavailable</mat-option> </mat-select> </mat-form-field> </td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td colspan="2" class="content-center"> <button style="margin:5px" mat-raised-button color="accent" (click)="submit()">Submit Incident</button> <button style="margin:5px" mat-raised-button color="accent" (click)="reset()">Clear</button> <button style="margin:5px" mat-raised-button color="accent">Raise BGCR</button> <button style="margin:5px" mat-raised-button color="accent">Raise Jira</button> </td> </tr> </table> </form> </mat-card-content> </mat-card> </div> 您需要移除 <h1>INCIDENT MANAGEMENT SYSTEM</h1> 或将其放入 <mat-toolbar-row> 内。 我无法在垫子工具栏中填充图像 有什么帮助吗?


为什么每次我尝试将应用程序从 Anypoint Studio 部署到 CloudHub 时,我的 pom.xml 文件都会更新?

我的 pom.xml 文件中有以下部分用于我正在执行的虚拟项目: org.mule.tools.maven mule-maven-插件 我正在做的一个虚拟项目的 pom.xml 文件中有以下部分: <plugin> <groupId>org.mule.tools.maven</groupId> <artifactId>mule-maven-plugin</artifactId> <version>${mule.maven.plugin.version}</version> <extensions>true</extensions> <configuration> <classifier>mule-application</classifier> </configuration> </plugin> 每当我尝试直接从 Studio 将应用程序部署到 CloudHub 时,上面的部分就会更改为以下部分: <plugin> <groupId>org.mule.tools.maven</groupId> <artifactId>mule-maven-plugin</artifactId> <version>${mule.maven.plugin.version}</version> <extensions>true</extensions> <configuration> <classifier>---- select project type ----</classifier> </configuration> </plugin> 然后部署失败并出现以下错误: Publication status: error [INFO] ------------------------------------------------------------ [INFO] Steps: [INFO] - Description: Publishing asset [INFO] - Status: error [INFO] - Errors: [The asset is invalid, Error while trying to set type: app. Expected type is: rest-api.] [INFO] ......................................... [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 02:33 min [INFO] Finished at: 2024-01-08T14:11:31+05:30 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.mule.tools.maven:exchange-mule-maven-plugin:0.0.17:exchange-deploy (default-exchange-deploy) on project super-biodata-sapi: Exchange publication failed: Publication ended with errors: [The asset is invalid, Error while trying to set type: app. Expected type is: rest-api.] -> [Help 1] 这可能是什么原因? 以下是一些细节: Anypoint Studio版本:7.16.0 Maven版本:3.8.8 Mule 运行时版本:4.4.0 Mule Maven 插件版本:3.8.0/4.0.0(两者都尝试过) Java版本:OpenJDK 11.0.9 我以前使用过 Anypoint Studio 7.15,在那里完全相同的项目没有任何问题。但更新后,我遇到了很多问题。 我还尝试使用“rest-api”而不是“mule-application”。然后,首先在部署开始时,“rest-api”更改为“mule-application”,然后再次更改为“----选择项目类型----”,最后失败。 我怀疑存在混乱。您提到您正在尝试将 Mule 4 应用程序部署到 CloudHub,但对资产的引用和错误消息与将资产发布到 Any point Exchange 相关。 CloudHub是一个部署和执行Mule应用程序的云平台。 Anypoint Exchange 是资产存储库,包括 REST API 的定义,但不包括 Mule 4 应用程序,也不用于执行任何操作。有关有效资产的详细信息,请参阅文档。 由于 mule-application 不是发布到 Exchange 的有效资产类型(对于 Mule 4),那么 Studio 似乎试图让您更改为有效的资产类型。 如果您尝试部署到 CloudHub,请参阅文档了解不同的方法。


完整日历:使用 IF 语句为事件着色

我有一个基于站点管理员打开的票证的日历。我们有四种类型的门票: 待办的 进行中 完成的 取消 这是我有日历的 div: 我有一个基于站点管理员打开的票证的日历。我们有四种类型的门票: 待定 进行中 完成了 取消 这是我有日历的div: <div class="col-lg-6 col-md-10 col-sm-11"> <div class="card"> <div class="card-header" data-background-color="blue"> <h4 class="title">Calendario</h4> </div> <br> <section class="content"> <?php $events = TicketData::getEvents(); foreach($events as $event){ $thejson[] = array("title"=>$event->title,"url"=>"./?view=editticket&id=".$event->id,"start"=>$event->date_at."T".$event->time_at); } // print_r(json_encode($thejson)); ?> <script> $(document).ready(function() { $('#calendar').fullCalendar({ header: { left: 'prev,next, today', center: 'title', right: 'month,agendaWeek,agendaDay' }, defaultDate: jQuery.now(), editable: false, eventLimit: true, // allow "more" link when too many events events: <?php echo json_encode($thejson); ?> }); }); </script> <div class="row"> <div class="col-md-12"> <div id="calendar"> </div> </div> </div> </section> </div> </div> 门票的数据库结构很简单:id、title、description、date_at、time_at、created_at、tecnico_id和status_id。 我想使用 if 脚本“着色”事件: 这是我的代码,但它不起作用。 <section class="content"> <?php $events = TicketData::getEvents(); // $status->status_id; foreach($events as $event){ $thejson[] = array("title"=>$event->title,"url"=>"./?view=editticket&id=".$event->id,"start"=>$event->date_at."T".$event->time_at,); $thejsonColor[] = array($event->status_id); } // print_r(json_encode($thejson)); ?> <script> $(document).ready(function() { $('#calendar').fullCalendar({ header: { left: 'prev,next, today', center: 'title', right: 'month,agendaWeek,agendaDay' }, defaultDate: jQuery.now(), editable: false, eventLimit: true, // allow "more" link when too many events events: <?php echo json_encode($thejson); ?>, if ($thejsonColor=1){ eventColor: 'fb8c00' }else if ($thejsonColor=2){ eventColor: 'ff0' } else if ($thejsonColor=3){ eventColor: '43a047' } else { eventColor: '00acc1' } }); }); </script> 我想让它们符合颜色标准,这样用户就可以知道哪些票是待处理的、不完整的、完整的和已取消的。 我是 javascript 的新手,我不知道如何做到这一点。你们能帮助我或指出我应该如何做吗? 您可以在迭代事件数组时设置颜色: <?php // helper function to pick the right color function getColor($id) { $eventColor = ''; if ($id == 1) { $eventColor = '#fb8c00'; } else if ($id == 2) { $eventColor = '#ff0'; } else if ($id == 3) { $eventColor = '#43a047'; } else { $eventColor = '#00acc1'; } return $eventColor; } $events = TicketData::getEvents(); //pulls the events from TicketData.php foreach($events as $event) { $thejson[] = array( "title" => $event->title, "url" => "./?view=editticket&id=".$event->id, "start" => $event->date_at."T".$event->time_at, "color" => getColor($event->status_id)); } ?> 然后就像你现在正在做的那样回显事件: <script> $(document).ready(function() { $('#calendar').fullCalendar({ header: { left: 'prev,next, today', center: 'title', right: 'month,agendaWeek,agendaDay' }, defaultDate: jQuery.now(), editable: false, eventLimit: true, // allow "more" link when too many events events: <?php echo json_encode($thejson); ?>, }); }); </script> 或者您可以通过从 php 中的表中选择来完成此操作,例如: $sql = "SELECT CASE WHEN tickets='Pending'" THEN '#C6E0B4' WHEN tickets='In progres' THEN '#FFFF99' END AS color" $schedules = $conn->query($sql); $sched_res = []; foreach($schedules->fetch_all(MYSQLI_ASSOC) as $row){ $sched_res[$row['id']] = $row; } 然后就像你现在正在做的那样回显事件: <script> $(document).ready(function() { $('#calendar').fullCalendar({ header: { left: 'prev,next, today', center: 'title', right: 'month,agendaWeek,agendaDay' }, defaultDate: jQuery.now(), editable: false, eventLimit: true, // allow "more" link when too many events events: <?php echo json_encode($thejson); ?>, }); }); </script>


PHP 函数 ssh2_connect 不起作用

以下是我的脚本: 以下是我的脚本: <?php $connection = ssh2_connect('XX.XX.XX.XX', 22); ssh2_auth_password($connection, 'root', '******'); $stream = ssh2_exec($connection, 'useradd -d /home/users/test -m testftp'); $stream = ssh2_exec($connection, 'passwd testftp'); $stream = ssh2_exec($connection, 'password'); $stream = ssh2_exec($connection, 'password'); ?> 它显示以下错误: Fatal error: Call to undefined function ssh2_connect() in /home/chaosnz/public_html/fotosnap.net/test.php on line 2 我该如何处理这个问题? 谢谢 老实说,我建议使用 phpseclib,这是一个纯 PHP SSH2 实现。示例: <?php include('Net/SSH2.php'); $ssh = new Net_SSH2('www.domain.tld'); if (!$ssh->login('username', 'password')) { exit('Login Failed'); } echo $ssh->exec('pwd'); echo $ssh->exec('ls -la'); ?> 它更加便携、更易于使用并且功能也更加丰富。 我已经安装了 SSH2 PECL 扩展,它工作正常,感谢大家的帮助... 我已经在 ubuntu 16.4 PHP 7.0.27-0+deb9u 和 nginx 上解决了这个问题 sudo apt install php-ssh2 您需要安装ssh2 lib sudo apt-get install libssh2-php && sudo /etc/init.d/apache2 restart 这应该足以让你上路 如果您在 OSX 上运行 bomebrew,我使用以下命令来安装它: brew install php56-ssh2 这对我有用。我从这里拉它。应该还有使用 mac 端口的 Ubuntu 和 OSX。 我正在运行 CentOS 5.6 作为我的开发环境,以下内容对我有用。 su - pecl install ssh2 echo "extension=ssh2.so" > /etc/php.d/ssh2.ini /etc/init.d/httpd restart 为了扩展 @neubert 答案,如果您使用 Laravel 5 或类似版本,您可以使用更简单的 phpseclib,如下所示: 奔跑composer require phpseclib/phpseclib ~2.0 在您的控制器中添加 use phpseclib\Net\SSH2; 然后在控制器方法中使用它,例如: $host = config('ssh.host'); $username = config('ssh.username'); $password = config('ssh.password'); $command = 'php version'; $ssh = new SSH2($host); if (!$ssh->login($username, $password)) { $output ='Login Failed'; } else{ $output = $ssh->exec($command); } 今天pecl install ssh2需要旧版本的php(<=6.0). Here https://pecl.php.net/package/ssh2您可以看到支持php7和php8的最新beta版本的ssh2。所以您应该安装其中之一: pecl install ssh2-1.3.1 * 不要忘记在 php.ini 文件中启用此 ssh2.so 扩展。 我知道有答案,但我只是在这里简化答案。 我有同样的问题,我在 ubuntu 20 中使用以下解决方案修复了它: sudo apt-get install libssh2-1 php7.1-ssh2 -y 您可以根据需要更改 php 版本,例如:php7.4-ssh2 参考:https://blog.programster.org/ubuntu-16-04-install-php-ssh2-extension 适用于 WHM 面板 菜单 > 服务器配置 > 终端: yum install libssh2-devel -y 菜单 > 软件 > 模块安装程序 PHP PECL 管理点击 ssh2 立即安装点击 菜单 > 重新启动服务 > HTTP 服务器 (Apache) 您确定要重新启动此服务吗? 是的 ssh2_connect() 工作了! 我觉得这个已有 11 年历史的讨论值得更新。我从 PHPSecLib 库切换到 PHP 7 和 8 的内置 SSH2 库,因为它似乎连接速度更快并且更标准。现在它还可以使用密钥密码,因此无需再使用第 3 方库。


© www.soinside.com 2019 - 2024. All rights reserved.