modal-dialog 相关问题

指用于向用户显示重要信息的图形对话框。这些对话框显示在所有其他内容之上,阻止应用程序流,直到收到用户输入。

如何解决模态弹出窗口未关闭的问题

在我的项目页面上,我在卡片中显示项目,当您单击卡片时,会弹出一个模式,其中包含有关该项目的详细信息。这与“服务”页面相同。一切正常

回答 1 投票 0

ContentPage 的内容未填满整个页面 - 毛伊岛

在我的应用程序(适用于 iOS,使用 iPhone 14 Plus 进行测试)中,我有一个页面想要显示为模式。目前的问题是,当我将其显示为模式时,内容没有填充整个...

回答 1 投票 0

动态创建jquery模态对话框

我想在运行我的页面时动态创建一个 jquery 对话框模式,但我无法获得它模式,我得到一个无模式对话框 这是我的简单代码 函数 show()...</desc> <question vote="0"> <p>我想在运行我的页面时动态创建一个jquery对话框模式,但我无法得到它<strong>modal</strong>,我得到一个无模式对话框</p> <p>这是我的简单代码</p> <pre><code> &lt;script&gt; function show() { var dialog = $(&#39;&lt;div id=&#34;msg_dialog&#34;&gt;&lt;/div&gt;&#39;).dialog(); dialog.dialog({ modal: true, autoOpen: true, title: &#39;Test&#39;, buttons: [ { text: &#39;Ok&#39;, click: function() { $(&#39;#res&#39;).empty().append(&#39;&lt;h1&gt;Open&lt;h1&gt;&#39;); $(&#39;#msg_dialog&#39;).remove(); } }, { text: &#39;Cancel&#39;, click: function() { $(&#39;#res&#39;).empty().append(&#39;&lt;h1&gt;Close&lt;h1&gt;&#39;); $(&#39;#msg_dialog&#39;).remove(); } } ] }); } &lt;/script&gt; </code></pre> </question> <answer tick="false" vote="0"> <p><strong>加载模态加载</strong> 确保在加载时运行该函数。 试试这个代码: 将 <pre><code>&lt;body&gt;</code></pre> 替换为 </p> <pre><code>&lt;body onload=&#34;show();&#34;&gt; </code></pre> <p>或者你可以添加这一行</p> <pre><code>window.onload = function(){show();}; </code></pre> <p><strong>简单的模态代码可帮助您纠正代码</strong></p> <pre><code>$(&#34;#dialog-message&#34;).dialog({ modal: true, draggable: false, resizable: false, position: [&#39;center&#39;, &#39;top&#39;], show: &#39;blind&#39;, hide: &#39;blind&#39;, width: 400, dialogClass: &#39;ui-dialog-osx&#39;, buttons: { &#34;I&#39;ve read and understand this&#34;: function() { $(this).dialog(&#34;close&#34;); } } }); </code></pre> <p>来源:<a href="http://jsfiddle.net/db5SX/" rel="nofollow">http://jsfiddle.net/db5SX/</a></p> </answer> </body></html>

回答 0 投票 0

Ionic 5 模态模态缺少离子背景

当我在另一个模态之上打开一个模态时,为什么我的离子背景 + 模态阴影样式不起作用? 前言:这在 V4 上运行良好,但在升级到 V5 时出现问题。我不想变...

回答 5 投票 0

Scriptaculous / 原型模态窗口

我想使用prototype和scriptaculous制作一个模态窗口。我想知道是否有任何网站有教程,或者是否有人可以给我一些想法从哪里开始。 (我不...

回答 1 投票 0

React 中的自定义模式(打开和关闭问题)

所以,我正在尝试在 React 中制作一个模态。我将模态与触发并渲染它以显示自身的元素分离到另一个文件中。模式打开,但由于某种原因,当我尝试...

回答 1 投票 0

Discord Modal 更新后不更新 TextInput 标签 (Python)

过去几天我一直在学习如何编写机器人并有了大概的想法,但现在我遇到了这个问题: 类 FormButtons(discord.ui.View): def __init__(自身): 超级()。

回答 1 投票 0

启用csrf时,在codeigniter4中从模态提交表单时出现303错误

我有一个 codeignter4 Web 应用程序,具有以下视图,其中有一个提交数据的模式。 函数删除确认(网址){ $('#btn-delete').attr('href', url); ...</desc> <question vote="1"> <p>我有一个 codeignter4 Web 应用程序,具有以下视图,其中有一个提交数据的模式。</p> <pre><code>&lt;script&gt; function deleteConfirm(url){ $(&#39;#btn-delete&#39;).attr(&#39;href&#39;, url); $(&#39;#deleteModal&#39;).modal(); } &lt;/script&gt; &lt;!-- Begin Page Content --&gt; &lt;div class=&#34;container-fluid&#34;&gt; &lt;!-- Page Heading --&gt; &lt;h1 class=&#34;h3 mb-4 text-gray-800&#34;&gt;&lt;?= esc($title); ?&gt;&lt;/h1&gt; &lt;div class=&#34;col-lg-7&#34;&gt; &lt;?php if(session()-&gt;getFlashdata(&#39;message&#39;)):?&gt; &lt;?= session()-&gt;getFlashdata(&#39;message&#39;) ?&gt; &lt;?php endif; unset($_SESSION[&#39;message&#39;]); ?&gt; &lt;/div&gt; &lt;div class=&#34;card col-lg-7 shadow mb-4&#34;&gt; &lt;div class=&#34;card-header py-3&#34;&gt; &lt;h6 class=&#34;m-0 font-weight-bold text-primary&#34;&gt;&lt;a href=&#34;&#34; data-toggle=&#34;modal&#34; data-target=&#34;#newRoleModal&#34;&gt;&lt;i class=&#34;fas fa-plus&#34;&gt;&lt;/i&gt; Add New&lt;/a&gt;&lt;/h6&gt; &lt;/div&gt; &lt;div class=&#34;card-body&#34;&gt; &lt;div class=&#34;table-responsive&#34;&gt; &lt;table class=&#34;table table-bordered table-hover table-striped&#34; id=&#34;dataTable&#34; width=&#34;100%&#34; cellspacing=&#34;0&#34;&gt; &lt;!--&lt;thead class=&#34;thead-dark&#34;&gt;--&gt; &lt;thead class=&#34;bg-warning&#34;&gt; &lt;tr&gt; &lt;th&gt;#&lt;/th&gt; &lt;th&gt;Authority&lt;/th&gt; &lt;th&gt;Action&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;?php $index = 1; ?&gt; &lt;?php foreach($role as $r) : ?&gt; &lt;tr&gt; &lt;td&gt;&lt;?= esc($index); ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?= esc($r[&#39;role&#39;]); ?&gt;&lt;/td&gt; &lt;td&gt; &lt;a class=&#34;badge badge-primary&#34; style=&#34;font-size:14px;&#34; href=&#34;&lt;?= site_url(&#39;admin/roleaccess/&#39;.$r[&#39;id&#39;]); ?&gt;&#34;&gt;Manage Access&lt;/a&gt; &lt;a class=&#34;badge badge-success&#34; style=&#34;font-size:14px;&#34; href=&#34;&lt;?= site_url(&#39;admin/editrole/&#39;.$r[&#39;id&#39;]); ?&gt;&#34;&gt;Update&lt;/a&gt; &lt;a class=&#34;badge badge-danger&#34; style=&#34;font-size:14px;&#34; href=&#34;#!&#34; onclick=&#34;deleteConfirm(&#39;&lt;?= site_url(&#39;admin/deleterole/&#39;.$r[&#39;id&#39;]); ?&gt;&#39;)&#34;&gt;Delete&lt;/a&gt; &lt;/td&gt; &lt;/tr&gt; &lt;?php $index++; ?&gt; &lt;?php endforeach; ?&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- /.container-fluid --&gt; &lt;/div&gt; &lt;!-- End of Main Content --&gt; &lt;!-- Modal add new role--&gt; &lt;div class=&#34;modal fade&#34; id=&#34;newRoleModal&#34; tabindex=&#34;-1&#34; role=&#34;dialog&#34; aria-labelledby=&#34;newRoleModalLabel&#34; aria-hidden=&#34;true&#34;&gt; &lt;div class=&#34;modal-dialog&#34;&gt; &lt;div class=&#34;modal-content&#34;&gt; &lt;div class=&#34;modal-header&#34;&gt; &lt;h5 class=&#34;modal-title&#34; id=&#34;newRoleModalLabel&#34;&gt;Add New Authority&lt;/h5&gt; &lt;button type=&#34;button&#34; class=&#34;close&#34; data-dismiss=&#34;modal&#34; aria-label=&#34;Close&#34;&gt; &lt;span aria-hidden=&#34;true&#34;&gt;&amp;times;&lt;/span&gt; &lt;/button&gt; &lt;/div&gt; &lt;!-- form --&gt; &lt;?php $attributes = array(&#39;id&#39; =&gt; &#39;myform&#39;); ?&gt; &lt;?= form_open(&#39;admin/addrole&#39;); ?&gt; &lt;div class=&#34;modal-body&#34;&gt; &lt;div class=&#34;form-group&#34;&gt; &lt;input type=&#34;text&#34; class=&#34;form-control&#34; id=&#34;role&#34; name=&#34;role&#34; placeholder=&#34;Name of Authority&#34;&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class=&#34;modal-footer&#34;&gt; &lt;button type=&#34;button&#34; class=&#34;btn btn-secondary&#34; data-dismiss=&#34;modal&#34;&gt;Cancel&lt;/button&gt; &lt;button type=&#34;submit&#34; class=&#34;btn btn-success&#34;&gt;Add&lt;/button&gt; &lt;/div&gt; &lt;? = form_close(); ?&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- modal delete --&gt; &lt;div class=&#34;modal fade&#34; id=&#34;deleteModal&#34; tabindex=&#34;-1&#34; role=&#34;dialog&#34; aria-labelledby=&#34;exampleModalLabel&#34; aria-hidden=&#34;true&#34;&gt; &lt;div class=&#34;modal-dialog&#34; role=&#34;document&#34;&gt; &lt;div class=&#34;modal-content&#34;&gt; &lt;div class=&#34;modal-header&#34;&gt; &lt;h5 class=&#34;modal-title&#34; id=&#34;exampleModalLabel&#34;&gt;Are you sure?&lt;/h5&gt; &lt;button class=&#34;close&#34; type=&#34;button&#34; data-dismiss=&#34;modal&#34; aria-label=&#34;Close&#34;&gt; &lt;span aria-hidden=&#34;true&#34;&gt;×&lt;/span&gt; &lt;/button&gt; &lt;/div&gt; &lt;div class=&#34;modal-body&#34;&gt;Deleted data cannot be recovered!!&lt;/div&gt; &lt;div class=&#34;modal-footer&#34;&gt; &lt;button class=&#34;btn btn-secondary&#34; type=&#34;button&#34; data-dismiss=&#34;modal&#34;&gt;Cancel&lt;/button&gt; &lt;a id=&#34;btn-delete&#34; class=&#34;btn btn-danger&#34; href=&#34;#&#34;&gt;Remove&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>启用 csrf 时,表单提交会重定向到视图本身。当我检查 Web 控制台“网络”选项卡时,它在 addrole 上显示 303 状态,这是处理表单提交数据的控制器方法。然而,当 csrf 被禁用时它工作正常。我怎样才能让它工作</p> <p>我的过滤器类</p> <pre><code>&lt;?php namespace Config; use CodeIgniter\Config\BaseConfig; use CodeIgniter\Filters\CSRF; use CodeIgniter\Filters\DebugToolbar; use CodeIgniter\Filters\Honeypot; use CodeIgniter\Filters\InvalidChars; use CodeIgniter\Filters\SecureHeaders; class Filters extends BaseConfig { /** * Configures aliases for Filter classes to * make reading things nicer and simpler. * * @var array */ public $aliases = [ &#39;csrf&#39; =&gt; CSRF::class, &#39;toolbar&#39; =&gt; DebugToolbar::class, &#39;honeypot&#39; =&gt; Honeypot::class, &#39;invalidchars&#39; =&gt; InvalidChars::class, &#39;secureheaders&#39; =&gt; SecureHeaders::class, &#39;auth&#39; =&gt; \App\Filters\Auth::class, ]; /** * List of filter aliases that are always * applied before and after every request. * * @var array */ /*public $globals = [ &#39;before&#39; =&gt; [ // &#39;honeypot&#39;, &#39;csrf&#39;, // &#39;invalidchars&#39;, ], &#39;after&#39; =&gt; [ //&#39;toolbar&#39;, // &#39;honeypot&#39;, // &#39;secureheaders&#39;, ], ];*/ public $globals = [ &#39;before&#39; =&gt; [ //&#39;honeypot&#39;, &#39;csrf&#39;, //&#39;isLoggedIn&#39; =&gt; [&#39;except&#39; =&gt; [&#39;/&#39;, &#39;admin&#39;,&#39;users&#39;, &#39;dashboard&#39;, &#39;logout&#39;,&#39;auth&#39;,&#39;Ticket/getStatusCounts&#39;]], //&#39;isGranted&#39; =&gt; [&#39;except&#39; =&gt; [&#39;/&#39;, &#39;admin&#39;, &#39;users&#39;,&#39;dashboard&#39;, &#39;logout&#39;,&#39;auth&#39;, &#39;blocked&#39;, &#39;home&#39;, &#39;Welcome/*&#39;,&#39;Registration/*&#39;,&#39;profile&#39;,&#39;profile_save&#39;,&#39;profile_edit&#39;,&#39;Ticket/getStatusCounts&#39;]], ], &#39;after&#39; =&gt; [ &#39;toolbar&#39;, // &#39;honeypot&#39;, ], ]; /** * List of filter aliases that works on a * particular HTTP method (GET, POST, etc.). * * Example: * &#39;post&#39; =&gt; [&#39;foo&#39;, &#39;bar&#39;] * * If you use this, you should disable auto-routing because auto-routing * permits any HTTP method to access a controller. Accessing the controller * with a method you don’t expect could bypass the filter. * * @var array */ public $methods = []; /** * List of filter aliases that should run on any * before or after URI patterns. * * Example: * &#39;isLoggedIn&#39; =&gt; [&#39;before&#39; =&gt; [&#39;account/*&#39;, &#39;profiles/*&#39;]] * * @var array */ public $filters = []; } </code></pre> <p>我的配置/应用程序文件</p> <pre><code>&lt;?php namespace Config; use CodeIgniter\Config\BaseConfig; use CodeIgniter\Session\Handlers\FileHandler; class App extends BaseConfig { /** * -------------------------------------------------------------------------- * Base Site URL * -------------------------------------------------------------------------- * * URL to your CodeIgniter root. Typically this will be your base URL, * WITH a trailing slash: * * http://example.com/ * * If this is not set then CodeIgniter will try guess the protocol, domain * and path to your installation. However, you should always configure this * explicitly and never rely on auto-guessing, especially in production * environments. * * @var string */ public $baseURL = &#39;http://localhost/demo/public&#39;; /** * -------------------------------------------------------------------------- * Index File * -------------------------------------------------------------------------- * * Typically this will be your index.php file, unless you&#39;ve renamed it to * something else. If you are using mod_rewrite to remove the page set this * variable so that it is blank. * * @var string */ public $indexPage = &#39;index.php&#39;; /** * -------------------------------------------------------------------------- * URI PROTOCOL * -------------------------------------------------------------------------- * * This item determines which getServer global should be used to retrieve the * URI string. The default setting of &#39;REQUEST_URI&#39; works for most servers. * If your links do not seem to work, try one of the other delicious flavors: * * &#39;REQUEST_URI&#39; Uses $_SERVER[&#39;REQUEST_URI&#39;] * &#39;QUERY_STRING&#39; Uses $_SERVER[&#39;QUERY_STRING&#39;] * &#39;PATH_INFO&#39; Uses $_SERVER[&#39;PATH_INFO&#39;] * * WARNING: If you set this to &#39;PATH_INFO&#39;, URIs will always be URL-decoded! * * @var string */ public $uriProtocol = &#39;REQUEST_URI&#39;; /** * -------------------------------------------------------------------------- * Default Locale * -------------------------------------------------------------------------- * * The Locale roughly represents the language and location that your visitor * is viewing the site from. It affects the language strings and other * strings (like currency markers, numbers, etc), that your program * should run under for this request. * * @var string */ public $defaultLocale = &#39;en&#39;; /** * -------------------------------------------------------------------------- * Negotiate Locale * -------------------------------------------------------------------------- * * If true, the current Request object will automatically determine the * language to use based on the value of the Accept-Language header. * * If false, no automatic detection will be performed. * * @var bool */ public $negotiateLocale = false; /** * -------------------------------------------------------------------------- * Supported Locales * -------------------------------------------------------------------------- * * If $negotiateLocale is true, this array lists the locales supported * by the application in descending order of priority. If no match is * found, the first locale will be used. * * @var string[] */ public $supportedLocales = [&#39;en&#39;]; /** * -------------------------------------------------------------------------- * Application Timezone * -------------------------------------------------------------------------- * * The default timezone that will be used in your application to display * dates with the date helper, and can be retrieved through app_timezone() * * @var string */ public $appTimezone = &#39;Asia/Kolkata&#39;; /** * -------------------------------------------------------------------------- * Default Character Set * -------------------------------------------------------------------------- * * This determines which character set is used by default in various methods * that require a character set to be provided. * * @see http://php.net/htmlspecialchars for a list of supported charsets. * * @var string */ public $charset = &#39;UTF-8&#39;; /** * -------------------------------------------------------------------------- * URI PROTOCOL * -------------------------------------------------------------------------- * * If true, this will force every request made to this application to be * made via a secure connection (HTTPS). If the incoming request is not * secure, the user will be redirected to a secure version of the page * and the HTTP Strict Transport Security header will be set. * * @var bool */ public $forceGlobalSecureRequests = false; /** * -------------------------------------------------------------------------- * Session Driver * -------------------------------------------------------------------------- * * The session storage driver to use: * - `CodeIgniter\Session\Handlers\FileHandler` * - `CodeIgniter\Session\Handlers\DatabaseHandler` * - `CodeIgniter\Session\Handlers\MemcachedHandler` * - `CodeIgniter\Session\Handlers\RedisHandler` * * @var string */ public $sessionDriver = FileHandler::class; /** * -------------------------------------------------------------------------- * Session Cookie Name * -------------------------------------------------------------------------- * * The session cookie name, must contain only [0-9a-z_-] characters * * @var string */ public $sessionCookieName = &#39;ci_session&#39;; /** * -------------------------------------------------------------------------- * Session Expiration * -------------------------------------------------------------------------- * * The number of SECONDS you want the session to last. * Setting to 0 (zero) means expire when the browser is closed. * * @var int */ public $sessionExpiration = 7200; /** * -------------------------------------------------------------------------- * Session Save Path * -------------------------------------------------------------------------- * * The location to save sessions to and is driver dependent. * * For the &#39;files&#39; driver, it&#39;s a path to a writable directory. * WARNING: Only absolute paths are supported! * * For the &#39;database&#39; driver, it&#39;s a table name. * Please read up the manual for the format with other session drivers. * * IMPORTANT: You are REQUIRED to set a valid save path! * * @var string */ public $sessionSavePath = WRITEPATH . &#39;session&#39;; /** * -------------------------------------------------------------------------- * Session Match IP * -------------------------------------------------------------------------- * * Whether to match the user&#39;s IP address when reading the session data. * * WARNING: If you&#39;re using the database driver, don&#39;t forget to update * your session table&#39;s PRIMARY KEY when changing this setting. * * @var bool */ public $sessionMatchIP = false; /** * -------------------------------------------------------------------------- * Session Time to Update * -------------------------------------------------------------------------- * * How many seconds between CI regenerating the session ID. * * @var int */ public $sessionTimeToUpdate = 300; /** * -------------------------------------------------------------------------- * Session Regenerate Destroy * -------------------------------------------------------------------------- * * Whether to destroy session data associated with the old session ID * when auto-regenerating the session ID. When set to FALSE, the data * will be later deleted by the garbage collector. * * @var bool */ public $sessionRegenerateDestroy = false; /** * -------------------------------------------------------------------------- * Cookie Prefix * -------------------------------------------------------------------------- * * Set a cookie name prefix if you need to avoid collisions. * * @var string * * @deprecated use Config\Cookie::$prefix property instead. */ public $cookiePrefix = &#39;&#39;; /** * -------------------------------------------------------------------------- * Cookie Domain * -------------------------------------------------------------------------- * * Set to `.your-domain.com` for site-wide cookies. * * @var string * * @deprecated use Config\Cookie::$domain property instead. */ public $cookieDomain = &#39;&#39;; /** * -------------------------------------------------------------------------- * Cookie Path * -------------------------------------------------------------------------- * * Typically will be a forward slash. * * @var string * * @deprecated use Config\Cookie::$path property instead. */ public $cookiePath = &#39;/&#39;; /** * -------------------------------------------------------------------------- * Cookie Secure * -------------------------------------------------------------------------- * * Cookie will only be set if a secure HTTPS connection exists. * * @var bool * * @deprecated use Config\Cookie::$secure property instead. */ public $cookieSecure = false; /** * -------------------------------------------------------------------------- * Cookie HttpOnly * -------------------------------------------------------------------------- * * Cookie will only be accessible via HTTP(S) (no JavaScript). * * @var bool * * @deprecated use Config\Cookie::$httponly property instead. */ public $cookieHTTPOnly = true; /** * -------------------------------------------------------------------------- * Cookie SameSite * -------------------------------------------------------------------------- * * Configure cookie SameSite setting. Allowed values are: * - None * - Lax * - Strict * - &#39;&#39; * * Alternatively, you can use the constant names: * - `Cookie::SAMESITE_NONE` * - `Cookie::SAMESITE_LAX` * - `Cookie::SAMESITE_STRICT` * * Defaults to `Lax` for compatibility with modern browsers. Setting `&#39;&#39;` * (empty string) means default SameSite attribute set by browsers (`Lax`) * will be set on cookies. If set to `None`, `$cookieSecure` must also be set. * * @var string|null * * @deprecated use Config\Cookie::$samesite property instead. */ public $cookieSameSite = &#39;Lax&#39;; /** * -------------------------------------------------------------------------- * Reverse Proxy IPs * -------------------------------------------------------------------------- * * If your server is behind a reverse proxy, you must whitelist the proxy * IP addresses from which CodeIgniter should trust headers such as * HTTP_X_FORWARDED_FOR and HTTP_CLIENT_IP in order to properly identify * the visitor&#39;s IP address. * * You can use both an array or a comma-separated list of proxy addresses, * as well as specifying whole subnets. Here are a few examples: * * Comma-separated: &#39;10.0.1.200,192.168.5.0/24&#39; * Array: [&#39;10.0.1.200&#39;, &#39;192.168.5.0/24&#39;] * * @var string|string[] */ public $proxyIPs = &#39;&#39;; /** * -------------------------------------------------------------------------- * CSRF Token Name * -------------------------------------------------------------------------- * * The token name. * * @deprecated Use `Config\Security` $tokenName property instead of using this property. * * @var string */ public $CSRFTokenName = &#39;csrf_test_name&#39;; /** * -------------------------------------------------------------------------- * CSRF Header Name * -------------------------------------------------------------------------- * * The header name. * * @deprecated Use `Config\Security` $headerName property instead of using this property. * * @var string */ public $CSRFHeaderName = &#39;X-CSRF-TOKEN&#39;; /** * -------------------------------------------------------------------------- * CSRF Cookie Name * -------------------------------------------------------------------------- * * The cookie name. * * @deprecated Use `Config\Security` $cookieName property instead of using this property. * * @var string */ public $CSRFCookieName = &#39;csrf_cookie_name&#39;; /** * -------------------------------------------------------------------------- * CSRF Expire * -------------------------------------------------------------------------- * * The number in seconds the token should expire. * * @deprecated Use `Config\Security` $expire property instead of using this property. * * @var int */ public $CSRFExpire = 7200; /** * -------------------------------------------------------------------------- * CSRF Regenerate * -------------------------------------------------------------------------- * * Regenerate token on every submission? * * @deprecated Use `Config\Security` $regenerate property instead of using this property. * * @var bool */ public $CSRFRegenerate = false; /** * -------------------------------------------------------------------------- * CSRF Redirect * -------------------------------------------------------------------------- * * Redirect to previous page with error on failure? * * @deprecated Use `Config\Security` $redirect property instead of using this property. * * @var bool */ public $CSRFRedirect = false; /** * -------------------------------------------------------------------------- * CSRF SameSite * -------------------------------------------------------------------------- * * Setting for CSRF SameSite cookie token. Allowed values are: * - None * - Lax * - Strict * - &#39;&#39; * * Defaults to `Lax` as recommended in this link: * * @see https://portswigger.net/web-security/csrf/samesite-cookies * @deprecated `Config\Cookie` $samesite property is used. * * @var string */ public $CSRFSameSite = &#39;Lax&#39;; /** * -------------------------------------------------------------------------- * Content Security Policy * -------------------------------------------------------------------------- * * Enables the Response&#39;s Content Secure Policy to restrict the sources that * can be used for images, scripts, CSS files, audio, video, etc. If enabled, * the Response object will populate default values for the policy from the * `ContentSecurityPolicy.php` file. Controllers can always add to those * restrictions at run time. * * For a better understanding of CSP, see these documents: * * @see http://www.html5rocks.com/en/tutorials/security/content-security-policy/ * @see http://www.w3.org/TR/CSP/ * * @var bool */ public $CSPEnabled = false; } </code></pre> <p>我的安全课程</p> <pre><code>&lt;?php namespace Config; use CodeIgniter\Config\BaseConfig; class Security extends BaseConfig { /** * -------------------------------------------------------------------------- * CSRF Protection Method * -------------------------------------------------------------------------- * * Protection Method for Cross Site Request Forgery protection. * * @var string &#39;cookie&#39; or &#39;session&#39; */ public $csrfProtection = &#39;cookie&#39;; /** * -------------------------------------------------------------------------- * CSRF Token Randomization * -------------------------------------------------------------------------- * * Randomize the CSRF Token for added security. * * @var bool */ public $tokenRandomize = true; /** * -------------------------------------------------------------------------- * CSRF Token Name * -------------------------------------------------------------------------- * * Token name for Cross Site Request Forgery protection. * * @var string */ public $tokenName = &#39;csrf_test_name&#39;; /** * -------------------------------------------------------------------------- * CSRF Header Name * -------------------------------------------------------------------------- * * Header name for Cross Site Request Forgery protection. * * @var string */ public $headerName = &#39;X-CSRF-TOKEN&#39;; /** * -------------------------------------------------------------------------- * CSRF Cookie Name * -------------------------------------------------------------------------- * * Cookie name for Cross Site Request Forgery protection. * * @var string */ public $cookieName = &#39;csrf_cookie_name&#39;; /** * -------------------------------------------------------------------------- * CSRF Expires * -------------------------------------------------------------------------- * * Expiration time for Cross Site Request Forgery protection cookie. * * Defaults to two hours (in seconds). * * @var int */ public $expires = 7200; /** * -------------------------------------------------------------------------- * CSRF Regenerate * -------------------------------------------------------------------------- * * Regenerate CSRF Token on every submission. * * @var bool */ public $regenerate = false; /** * -------------------------------------------------------------------------- * CSRF Redirect * -------------------------------------------------------------------------- * * Redirect to previous page with error on failure. * * @var bool */ public $redirect = true; /** * -------------------------------------------------------------------------- * CSRF SameSite * -------------------------------------------------------------------------- * * Setting for CSRF SameSite cookie token. * * Allowed values are: None - Lax - Strict - &#39;&#39;. * * Defaults to `Lax` as recommended in this link: * * @see https://portswigger.net/web-security/csrf/samesite-cookies * * @var string * * @deprecated `Config\Cookie` $samesite property is used. */ public $samesite = &#39;Lax&#39;; } </code></pre> <p>请帮助我在启用 csrf 时使表单提交正常工作。</p> <p>我的 Codeigniter4 应用程序的视图具有提交表单数据的模式。当 csrf 启用时,这会发送 303 http 状态;但是,当禁用 csrf 时,表单会正确提交数据。 我应该在哪里更正才能使其在启用 csrf 的情况下工作。</p> </question> <answer tick="false" vote="0"> <p>您需要在ajax参数中添加csrf_token和hash,或者在表单中包含csrf_field。</p> <pre><code>For Ajax var token = &#39;&lt;?= csrf_token(); ?&gt;&#39;; var hash = &#39;&lt;?= csrf_hash(); ?&gt;&#39;; ajaxParam = { ... , [token] : hash }; $.ajax({....}); For Form submit add in form html &lt;?= csrf_field(); ?&gt; </code></pre> </answer> </body></html>

回答 0 投票 0

Javascript 在模态窗口关闭时停止 HTML5 视频播放

我在模态窗口上有一个 html5 视频元素。当我关闭窗口时,视频继续播放。我是 JS 的新手。有没有一种简单的方法可以将视频播放停止功能与

回答 12 投票 0

Google Apps 脚本 - 调用“google.script.run.function();”时,.HTML 模态菜单不执行 .gs 函数

我遇到了一个奇怪的 GAS 问题,每当我生成模态菜单并提交它时,有时 google.script.run 可以工作,有时它根本不执行我想要的功能。 有一个...

回答 1 投票 0

Material ui onClose 作为disableBackdropClick 的替代品

目前我有一个对话框 来自文档 https://materia...

回答 2 投票 0

为什么这个自定义模式不能在我的 WordPress 网站标题上工作?

如果我在标题中放置自定义 HTML 块并放置我的代码,则会出现该按钮,但该按钮的功能不起作用。如果我将自定义 HTML 放置在页面上其他任何位置的块中...

回答 1 投票 0

使用 showModal 打开时,HTML <dialog> 元素如何按照正常流程定位?

当将 元素与 .show() 一起使用时,它会根据正常位置等 CSS 属性进行定位。 是否可以使用 .showModal() 进行相同的定位? 即使在使用时 d...

回答 2 投票 0

在 Angular 中构建一个带有“不再显示”复选框的模式

我正在一个 Angular 项目(版本 16)中工作,我想构建一个带有“不再显示”复选框的对话框模式。 该过程将是这样的: 用户访问 Web 应用程序....

回答 3 投票 0

如何在 HTML5 和 CSS3 中自动弹出模态窗口

我在网上找到了一些代码,允许我创建和设计一个模式窗口,供访问者注册我们的时事通讯,但我希望这个模式窗口在打开索引页面时自动弹出...

回答 3 投票 0

在 Bootstrap Modal 中保存 Laravel 表单中的数据

我有一个引导模式对话框,它使用 laravel 形式来注册用户。 这是代码: 我有一个引导模式对话框,它使用 laravel 表单来注册用户。 这是代码: <div id="addPenggunaModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="ModalLabel" aria-hidden="true"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h3 id="ModalLabel">Tambah Pengguna Baru</h3> </div> <div class="modal-body"> {{ Form::open(array('url'=>'users/addpengguna','class'=>'form-horizontal', 'method'=> 'POST')) }} <ul> @foreach($errors->all() as $error) <li>{{ $error }}</li> @endforeach </ul> <div class="control-group"> <label for="firstname" class="control-label">First Name:</label> <div class="controls"> {{ Form::text('firstname', null, array('class'=>'span3', 'placeholder'=>'First Name')) }} </div> </div> <!-- /field --> <div class="control-group"> <label for="lastname" class="control-label">Last Name: </label> <div class="controls"> {{ Form::text('lastname', null, array('class'=>'span3', 'placeholder'=>'Last Name')) }} </div> </div> <!-- /field --> <div class="control-group"> <label for="email" class="control-label">Email Address: </label> <div class="controls"> {{ Form::text('email', null, array('class'=>'span3', 'placeholder'=>'Email Address')) }} </div> </div> <!-- /field --> <div class="control-group"> <label for="password" class="control-label">Password:</label> <div class="controls"> {{ Form::password('password', array('class'=>'span3', 'placeholder'=>'Password')) }} </div> </div> <!-- /field --> <div class="control-group"> <label for="confirm_password" class="control-label">Confirm Password:</label> <div class="controls"> {{ Form::password('password_confirmation', array('class'=>'span3', 'placeholder'=>'Confirm Password')) }} </div> </div> <!-- /field --> <div class="control-group"> <label for="type_user" class="control-label">Tipe Pengguna:</label> <div class="controls"> {{ Form::radio('level', '1'); }} Supervisor {{ Form::radio('level', '0'); }} Sales </div> </div> <!-- /field --> </form> </div> <div class="modal-footer"> {{ Form::submit('Simpan', array('class'=>'button btn btn-primary','id'=>'mdl_save_change'))}} <button class="btn" data-dismiss="modal" aria-hidden="true">Batal</button> </div> {{ Form::close() }} </div> 然后我使用控制器保存详细信息: public function postAddpengguna(){ /* function to add user in data pengguna */ $validator = Validator::make(Input::all(), User::$rules); if($validator -> passes()){ $user = new User; $user->firstname = Input::get('firstname'); $user->lastname = Input::get('lastname'); $user->email = Input::get('email'); $user->password = Hash::make(Input::get('password')); $user->level = Input::get('level'); /* save the following details */ $user->save(); return Redirect::to('pengguna'); } else { return Redirect::to('index'); } } 但是表单不会将任何数据保存到数据库中。我有另一个名为注册的页面,它可以工作。 我的问题: 如何从laravel表单提交跟踪POST,有浏览器扩展吗? 如何在 laravel 中跟踪错误日志 你知道我的问题是怎么回事吗? 提前谢谢您。 更新 这是描述其工作原理的屏幕截图。 引导模式: 当我按下提交按钮(模式中的蓝色按钮)时,我希望它将数据保存到数据库。函数 php 如上所示。 PS。我不使用任何 AJAX 来调用 FORM 中的值。但是当我使用 AJAX 时,总是出错,因为缺少 TOKEN。 首先检查表单的action和_token字段。要在表单中添加令牌字段,您应该在表单中包含以下行: <input type="hidden" name="_token" value="{{csrf_token()}}"> 要在项目中重复使用引导模式,您可以检查此Github链接 在最新版本的 laravel 5 中,您可以使用快捷方式获取 token 字段。 <form ... > {!! csrf_field() !!} </form> 在这种情况下,你会得到类似的东西 <input type="hidden" name="_token" value="hpyL7cUbCMFBGRfCi2dpzE5XHGj8WuyY2jqloKRx"> 在任何情况下,您都可以调用 csrf_token() 来获取令牌字符串,无论如何,我真的更喜欢 csrf_field() 替代方案。 您可以将此代码与您的ajax代码一起使用: $(function() { $.ajaxSetup({ headers: { 'X-CSRF-TOKEN': {!! json_encode(csrf_token()) !!} } }); });

回答 3 投票 0

使用 div 作为 jQuery 模式对话框的最简单方法

我想使用 jQuery 将 div 的内容显示为模式对话框。 有没有什么方法可以在不使用 Bootstrap 或其他任何东西的情况下做到这一点......? 我想以我自己的方式通过 ...

回答 1 投票 0

Bootstrap Modal 不会在 X 或关闭按钮上关闭,但会在 ESC 或单击覆盖层上关闭

嗯,标题说明了一切。我有一个默认的(从 Bootstrap 文档复制的)模态,它使用 $('#myModal').modal(); 打开但在任何情况下,模式都会以解雇 X 或取消 bu...

回答 5 投票 0

cordova 页面加载正在触发未打开的 Modal ng-repeat 脚本运行

我有一个模板 PageA 的控制器。 PageA 上有一个模式,仅在用户单击按钮时打开。 Modal 中是 ng-repeat;使用 ng-init,当 ng-repeat 完成时 ($last) t...

回答 1 投票 0

使用显示块 CSS Javascript 获取模态淡入效果

我正在努力让模式在单击按钮时获得动画效果。模态框隐藏时不得占用空间。所以我想在未显示时使用 display none 。当点击按钮时...

回答 3 投票 0

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