require

PHP DOMDocument missing

做~自己de王妃 提交于 2019-11-27 06:54:06
问题 I am getting an odd error when running $dom = new DOMDocument("1.0", "utf-8");: Warning : require_once(classes/DOMDocument.class.php) [function.require-once]: failed to open stream: No such file or directory in /var/www/html/cms/bootstrap.php on line 5 Fatal error : require_once() [function.require]: Failed opening required 'classes/DOMDocument.class.php' (include_path='.:/usr/share/pear:/usr/share/php:/var/www/html/cms/plugins/Zend/library') in /var/www/html/cms/bootstrap.php on line 5

How does require() in node.js work?

纵然是瞬间 提交于 2019-11-27 06:39:28
I tried this: // mod.js var a = 1; this.b = 2; exports.c = 3; // test.js var mod = require('./mod.js'); console.log(mod.a); // undefined console.log(mod.b); // 2 console.log(mod.c); // 3, so this === exports? So I image that require() may be implement like this: var require = function (file) { var exports = {}; var run = function (file) { // include "file" here and run }; run.apply(exports, [file]); return exports; } Is that right? Please help me to understand require(), or where can I find the source code. Thanks! Source code is here . exports / require are not keywords, but global variables.

了解Browserify

我的未来我决定 提交于 2019-11-27 06:10:43
Browserify 是一个Javascript的库,可以用来把多个Module打包到一个文件中,并且能很好地应对Modules之间的依赖关系。而Module是封装了属性和功能的单元,是一个Javascript对象,Modules之间可以相互依赖。某种程度上来说,Browserify模仿了Node.js加载Module的方式。一个js文件包含一个Module。所以,Browserify通过读取文件来加载该文件内的Module。 【module的写法】 'use strict'; exports.save = function(tasks){}; exports.load = function(){}; exports.clear = function(){}; 还可以这么写: 'use strict'; module.exports = { save: function(tasks){}, load: function(){}, clear: function(){} }; 【module的缓存】 1、单例模式缓存 module a exports.value = "original"; module b var a = require('./a'); a.value = "changed"; console.log(a.value);//changed module c var

React同构直出原理浅析

好久不见. 提交于 2019-11-27 06:06:32
通常,当客户端请求一个包含React组件页面的时候,服务端首先响应输出这个页面,客户端和服务端有了第一次交互。然后,如果加载组件的过程需要向服务端发出Ajax请求等,客户端和服务端又进行了一次交互,这样,耗时相对较长。服务端是否可以在页面初次加载时把所有方面渲染好再一次性响应给客户端呢? 「React同构直出」就是用来解决这个问题的,做到「秒开」页面。过程大致是这样滴: 1、在需要同构直出的页面(比如是index.html)放上占位符 <div id="root">@@@</div> ### 以上,当客户端发出首次请求,服务端渲染出组件的html内容放@@@这个位置,然后服务端再渲染出类似 <script>renderApp()</script> 这样的js代码段把组件最终渲染到DOM上。也就是说,renderApp方法实际上就是在渲染组件。 2、而为了直接调用renderApp方法,必须让renderApp方法成为window下的方法 window.renderApp = function(){ReactDOM.render(...)} 3、服务端取出index.html,渲染出占位符的内容,替代占位符,并一次性响应给客户端 通过一个例子来体会。 文件结构 browser.js(在这里把渲染组件的过程赋值给window.renderApp) bundle.js(把browser

PHP require file from top directory

我怕爱的太早我们不能终老 提交于 2019-11-27 05:44:40
问题 I have several subdomains contained in their own directory above my root site, and an assets folder in my root directory. For example: / /assets/ /forums/ /blog/ I'm trying to require() files on php pages in both the root directory, and the subdirectories, for example, assets/include/form.php is required() in both index.php in the root directory and index.php in the forums directory. However, inside form.php, is another require, trying to get another file contained in the include directory. I

When should I use require() and when to use define()?

只谈情不闲聊 提交于 2019-11-27 05:44:31
I have being playing around with requirejs for the last few days. I am trying to understand the differences between define and require. Define seems to allow for module separation and allow for dependency ordering to be adhere. But it downloads all the files it needs to begin with. Whilst require only loads what you need when you need it. Can these two be used together and for what purposes should each of them be used? wischan With define you register a module in require.js that you can then depend on in other module definitions or require statements. With require you "just" load/use a module

D-Link系列路由器漏洞挖掘

笑着哭i 提交于 2019-11-27 05:04:12
参考 http://www.freebuf.com/articles/terminal/153176.html https://paper.seebug.org/429/ http://www.s3cur1ty.de/m1adv2013-017 http://seclists.org/bugtraq/2013/Dec/11 http://www.devttys0.com/wp-content/uploads/2010/12/dlink_php_vulnerability.pdf https://packetstormsecurity.com/files/120591/dlinkdir645-bypass.txt 源码 D-Link路由器固件下载地址: ftp://ftp2.dlink.com/PRODUCTS/ binwalk解压固件 kali-linux自带binwalk,编译过程 $ sudo apt-get update $ sudo apt-get install build-essential autoconf git # https://github.com/devttys0/binwalk/blob/master/INSTALL.md $ git clone https://github.com/devttys0/binwalk.git $ cd binwalk #

Detect if called through require or directly by command line

隐身守侯 提交于 2019-11-27 04:56:37
问题 How can I detect whether my Node.JS file was called using SH: node path-to-file or JS: require('path-to-file') ? This is the Node.JS equivalent to my previous question in Perl: How can I run my Perl script only if it wasn't loaded with require? 回答1: if (require.main === module) { console.log('called directly'); } else { console.log('required as a module'); } See documentation for this here: https://nodejs.org/docs/latest/api/modules.html#modules_accessing_the_main_module 回答2: There is another

Subresource Integrity in angularJS App which uses Require JS

别来无恙 提交于 2019-11-27 04:46:44
问题 I have an angular application with below index.html file Consider in my index.html page I have the following code for SRI (SubResource Integrity) <html> <head> <meta http-equiv="Content-Security-Policy" content="script-src 'self' scripts/alert.js 'unsafe-inline' 'unsafe-eval' 'sha256-qznLcsROx4GACP2dm0UCKCzCG+HiZ1guq6ZZDob/Tng='"> <script src="scripts/alert.js" integrity="sha256-qznLcsROx4GACP2dm0UCKCzCG+HiZ1guq6ZZDob/Tng=" crossorigin="anonymous"></script> </head> </html> In case, if I am

how to require active record working outside of rails

做~自己de王妃 提交于 2019-11-27 04:20:47
问题 i need to require active record, but I am working outside of rails (here is why: Simple Ruby Input Validation Library). do I need to require the entire rails gem, or can i be DRYer? 回答1: Here's how I'm using ActiveRecord outside of Rails: #!/usr/bin/ruby require 'active_record' require 'mysql2' # or 'pg' or 'sqlite3' ActiveRecord::Base.establish_connection( adapter: 'mysql2', # or 'postgresql' or 'sqlite3' database: 'DB_NAME', username: 'DB_USER', password: 'DB_PASS', host: 'localhost' ) #