首页 \ 问答 \ 获取类构造函数(Get class constructor)

获取类构造函数(Get class constructor)

如何获得一个类构造函数名称而不实例化类?

例:

$class = 'someClass';
$constructor = somehow get constructor;

$args = array();
$object = call_user_func_array(array($class,$constructor),$args);

我需要的是通过将不确定数量的变量传递给它的构造函数来创建一个对象。


how to get a class constructor function name without instantiating the class?

example:

$class = 'someClass';
$constructor = somehow get constructor;

$args = array();
$object = call_user_func_array(array($class,$constructor),$args);

what I need is to create a object by passing a undetermined number of variables into it's constructor.


原文:https://stackoverflow.com/questions/3378276
更新时间:2024-01-14 14:01

最满意答案

尝试调整transform-origin:

document.body.style.transformOrigin = 'top left';
document.body.style.transform = 'scale(' + scaleFactor + ')';

您可能还需要调整身体的宽度和高度以匹配缩放比例。

var scaleFactor = 1.5;
document.body.style.transformOrigin = 'top left';
document.body.style.transform = 'scale(' + scaleFactor + ')';
document.body.style.width = 100 * scaleFactor + "%";
document.body.style.height = 100 * scaleFactor + "%";

有关变换的注释。 变换是虚构的,不会改变物理尺寸,包括x,y,宽度和高度。 所以你必须手动管理这些物理尺寸,以匹配你的“变换”尺寸,以保持滚动条的快乐。


Try adjusting the transform-origin:

document.body.style.transformOrigin = 'top left';
document.body.style.transform = 'scale(' + scaleFactor + ')';

You may also need to adjust the width and height of the body to match the scaling.

var scaleFactor = 1.5;
document.body.style.transformOrigin = 'top left';
document.body.style.transform = 'scale(' + scaleFactor + ')';
document.body.style.width = 100 * scaleFactor + "%";
document.body.style.height = 100 * scaleFactor + "%";

A note concerning transforms. Transforms are imaginary and don't alter physical dimensions including x, y, width and height. So you'll have to manage these physical dimensions manually to match your "transform'd" dimensions in order to keep the scroll bars happy.

相关问答

更多
  • 横幅文本不相对于屏幕移动,但灰色背景正在移动,因为您将其设置为屏幕高度的25%。 当您调整窗口的高度时,横幅会相应地进行调整。 只需删除高度属性。 删除行高并设置填充顶部。 将横幅设置为相对位置,使其覆盖表单。 加 #form { display: table; margin: 0 auto; } 并将表单的div更改为该ID。 删除放在body和html中的table-cell table-display。 将#imagesMain更改为position:relative。 工作方案: ...
  • 尝试调整transform-origin: document.body.style.transformOrigin = 'top left'; document.body.style.transform = 'scale(' + scaleFactor + ')'; 您可能还需要调整身体的宽度和高度以匹配缩放比例。 var scaleFactor = 1.5; document.body.style.transformOrigin = 'top left'; document.body.style.tra ...
  • 而不是使用比例,您可以增加div的高度/宽度以避免内容的缩放效果。 为了做到这一点使用的position:absolute与您的元素,并调整顶部/左/右/底部属性,而不是变换原点。 这里是一个例子(我用一些内容替换了webview以显示结果) html, body { /* added rule */ margin: 0; height: 100%; overflow: hidden; } .box { position: absolute; text-alig ...
  • 无需将图像包装在div中。 在css中设置宽度和高度。 设置最大宽度和最大高度。 保持图像宽高比是一项挑战。 首先,下面是使用您的代码的示例。 看完之后,您可能会提供有关您正在尝试实现的确切反馈。 http://codepen.io/seraphzz/pen/thGkI no need to wrap the image in a div. set width & height in css. set max width and max height. there is a challenge with k ...
  • 尝试设置此元标记 Try to set this meta tag
  • 更新 最后有机会重新审视这一点。 您只需要将以下内容添加到#nav li ul : position: absolute; z-index: 100; 适用于IE8 / 9,FF和Chrome,但子菜单的位置在IE7中是关闭的,不管有没有更改。 为了解决这个问题,我推荐使用任何您喜欢的方法来使用IE7特定CSS。 Updated Finally got a chance to take a fresh look at this. All you need is to add the following t ...
  • 你去: img { display: block; margin-left: auto; margin-right: auto; margin-top: auto; margin-bottom: 1rem; border: 0.1rem solid black; max-width: 200px; max-height: 200px; } .grow:hover { transform: scale(3); }
    添加vertical-align: top; 到你的section标签。 说明:块的display属性设置为inline-block ,因此它们将使用vertical-align属性,默认情况下为baseline 。 在您的情况下,您希望它们在顶部对齐,因此您必须指定它。 * { margin: 0; padding: 0; } header, section, footer, aside, nav, article, hgroup { display: inline-bl ...
  • 添加z-index以使悬停图像始终位于顶部,并且您可以向详细文本添加overflow:hidden和top:0 : /* Partners page */ .masonry { /* Masonry container */ column-count: 5; } .brick img { width: 100%; height: 100%; } body { font-family: 'Gotham-Light'; margin: 0; bac ...
  • body { padding:30px; } a { display: inline-block; transition: all 4s; } a:hover { transform: scale(2); } Link 您应该使用display:inline-block来使其工作。 如果它是您要找的,请+1。 body { padding:30px; } a { display: inline-block; transit ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。