jQuery.ready
?php闭包或匿名函数用于创建函数而不指定其名称.
是否可以像在JavaScript中那样分配标识符来调用它们?例如
(function(){
echo('anonymous function');
})();
Run Code Online (Sandbox Code Playgroud)
use
在定义匿名函数时构造的正确用法是什么?在具有私有属性可访问性的公共方法中,匿名函数的状态是什么?
$anon_func =
function($my_param) use($this->object_property){ //use of $this is erroneous here
echo('anonymous function');
};
Run Code Online (Sandbox Code Playgroud) 背景
根据我的经验,当我的ubuntu工作站在具有活动目录的域上配置时,为我创建的用户名是根据以下模式.
DOMAIN_NAME \用户名
在linux上使用apache 的userdir扩展将需要在URL中使用用户名才能访问主目录中的public_html.
问题A:
Chrome将URL中的所有反斜杠" \ "字符转换为正斜杠" / ",结果网址变为完全不同,并且始终显示" 未找到"结果.
另一方面, Firefox 不会将斜杠转换为正斜杠,因此Web服务器会向目标目标提供http请求.
Common solution is to encode back slash in %5C.
Run Code Online (Sandbox Code Playgroud)
问题B:
如果我们在CSS @import构造中使用类似的路径(包含\ in path),则通过报告404错误而导致css文件作为HTTP Get Request的导入过程失败,并且404错误中报告的URL错过了\ altogether 的存在.这意味着在从中调用GET请求之前,会从URL中删除\.
这种行为在Firefox和Chrome中很常见.但他们有不寻常的解决方案
Firefox需要转义反斜杠才能在css导入过程中工作.
@import url(" http:// localhost/~domain_name \\ user_name/path/to/css ");
Chrome通常需要编码的反斜杠解决方案.
@import url(" http:// localhost/~domain_name%5Cuser_name/path/to/css ");
我很想知道如何将Drupal模块分解为多个包含文件.链接的一些钩子支持包括组件,如hook_menu,hook_theme等.
一旦我计划简化我的一个复杂模块,它已经达到2.3K的行,其中一半的功能集.由于缺乏关于包容范围的知识,我必须回滚所有这些步骤.
如果有一些详细信息,请帮助我.
对于某些要求,我需要传递其他信息以形成提交处理程序.在表单api中,将自定义提交处理程序定义为
$additional_args = array();
$form['#submit'][] = 'my_submit_handler'
Run Code Online (Sandbox Code Playgroud)
我希望提交处理程序为
function my_submit_handler($form, &$form_state, $additional_args){
Run Code Online (Sandbox Code Playgroud) 我正在通过hook_menu初始化一些项目(Drupal 6)
...
$items['webtv/block/%/playlist/edit/%'] = array(
...
'page arguments' => array('webtv_playlist_form', 2, 5),
...
);
$items['webtv/block/%/playlist/edit/%/filter/new'] = array(
...
'page arguments' => array('webtv_playlist_param_form', 2, 5),
...
);
$items['webtv/block/%/playlist/edit/%/filter/%'] = array(
...
'page arguments' => array('webtv_playlist_param_form', 2, 5, 7),
...
);
return $items;
Run Code Online (Sandbox Code Playgroud)
第一个条目是父条目,工作正常.以下两个是子条目.最后两个菜单条目仍然无效,并重定向到父页面视图.我通过从路径定义中删除第一个外卡"%/"标记进行了一些小修改来修复它.
手段:
$items['webtv/block/%/playlist/edit/%/filter/%']
Run Code Online (Sandbox Code Playgroud)
至
$items['webtv/block/playlist/edit/%/filter/%']
Run Code Online (Sandbox Code Playgroud)
和
$items['webtv/block/%/playlist/edit/%/filter/new']
Run Code Online (Sandbox Code Playgroud)
至
$items['webtv/block/playlist/edit/%/filter/new']
Run Code Online (Sandbox Code Playgroud)
通过添加外卡,请帮助我解决我的错误?超过两张外卡是无效的吗?
我为我的新工作站安装了一个干净的Ubuntu 10.10.
我用tasksel来安装lamp-server.
然后我使用a2enmod实用程序启用了userdir模块.
加载conf文件 /etc/apache2/mods-enabled/userdir.conf
<IfModule mod_userdir.c>
UserDir public_html
UserDir disabled root
<Directory /home/*/public_html>
AllowOverride All
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
Allow from all
Order allow,deny
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
</IfModule>
Run Code Online (Sandbox Code Playgroud)
我评论了所有那些推荐的行 /etc/apache2/mods-enabled/php5.conf
#<IfModule mod_userdir.c>
# <Directory /home/*/public_html>
# php_admin_value engine Off
# </Directory>
#</IfModule>
Run Code Online (Sandbox Code Playgroud)
我也曾经chmod -R 755 public_html
和chgrp -R www-data public_html
毕竟这个设置
http://localhost/~shoaib
结果...
您无权访问此服务器上的/ ~stiaib.
我在这里失踪了什么????
s:17:"thumbnail";
s:1:"1";
a:0:{}
a:9:{s:5:"title";s:2:"-5";s:10:"body_field";s:1:"0";s:20:"revision_information";s:1:"3";s:6:"author";s:1:"2";s:7:"options";s:1:"4";s:4:"menu";s:2:"-1";s:4:"path";s:1:"5";s:12:"image_attach";s:2:"-4";s:13:"path_redirect";s:1:"6";}
Run Code Online (Sandbox Code Playgroud)
这种符号的名称是什么?谁负责其标准化?
XML:
<skills>
<skill>PHP</skill>
<skill>CSS</skill>
<skill>HTML</skill>
<skill>XML</skill>
</skills>
Run Code Online (Sandbox Code Playgroud)
XSL:
<ul>
<xsl:for-each select="skills/skill">
<li><xsl:value-of select="[what should be xpath here]" /></li
</xsl:for-each>
</ul>
Run Code Online (Sandbox Code Playgroud)
这里打印每项技能的xpath应该是什么?
Drupal有一些内置视图,可以在没有Views
contrib模块的情况下工作.我们甚至无法管理或改变它们.frontpage
和taxonomy_term
是这种观点的两个例子.它们被称为默认视图.
我们如何通过模块开发生成自己的视图?
我的另一个问题是 Views
contrib模块.
views
模块如何增强drupal的视图功能?
use
带有 php 闭包的关键字是将精选变量的范围扩展到闭包的一种非常清晰的方法。
如果我们需要从闭包中更新调用者函数作用域中某个变量的值,有什么办法吗?
$total_strength = 0;
$all_cores->each(function($core) use ($total_strength) {
$total_strength += $code->strength;
});
print('Cumulative cores' strength is: ' . $total_strength);
Run Code Online (Sandbox Code Playgroud)
在这里我总是得到 0。如何解决这个问题?
drupal ×6
drupal-6 ×4
php ×2
apache2 ×1
backslash ×1
closures ×1
css ×1
drupal-fapi ×1
drupal-hooks ×1
drupal-views ×1
firefox ×1
jquery ×1
php-5.6 ×1
php-closures ×1
ubuntu-10.10 ×1
url ×1
xpath ×1
xslt ×1