问题标签 [globals]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
14 回答
88119 浏览

c - 常量变量存储在 C 中的什么位置?

我想知道常量变量存储在哪里。它和全局变量在同一个内存区域吗?还是在堆栈上?

0 投票
5 回答
254 浏览

php - 全局 php 帮助

我正在尝试在仅用于将数据发布到的文件中使用全局变量。全局未在该页面上注册。如何在该页面中访问全局变量。

编辑也许我不太清楚,所以让我把它弄清楚。我有这些文件

索引.php

post.php

现在从 index.php 我通过 jquery 发布到 post.php。但是,当我从 post.php 回显 $user->uid 时,它不会回显,但是当我从 index.php 回显它时,它会显示它。如何从 post.php 获取 $user->uid 访问权限。

0 投票
3 回答
2467 浏览

drools - 在 Drools 中设置全局变量

如何从规则中在 Drools 4 中设置全局?如果规则触发,我想设置一个布尔值,以便它可以从另一个显着性较低的规则中读取它。

0 投票
4 回答
1867 浏览

php - PHP:处理 MySQL 连接变量

创建 mysqli 对象后,处理 $db_conn 变量的最佳方法是什么?

我一直在使用

但这似乎很脏。我看到的替代方法是不断地将连接变量传递给调用它的每个函数,但这是一个巨大的痛苦。

0 投票
2 回答
475 浏览

c# - C# 通用数据参数

问候,

我是 OO 和编程的初学者,我有以下情况:

我有一组我实现的几个类共享的常量值和枚举。

这些类是独立的,即除了共享这些值之外,它们不相互交互,因此继承它们将不起作用。

我在想; 如果我只用这些常量和枚举创建一个空类,然后在每个类中声明这些类的一个对象,那么我可以使用这些值,例如:

globals.enum.enummember?

这是声音编程还是有更好的方法?

谢谢你的时间。

0 投票
3 回答
754 浏览

winapi - 如何在 Win32 中定位进程的全局和堆栈区域?

如何定位 Win32 进程的哪些内存区域包含每个线程的全局数据和堆栈数据?

0 投票
1 回答
309 浏览

python - 在python中将对象添加到另一个模块的全局变量

我知道这是非常邪恶的,但是是否可以将对象添加到另一个模块的全局变量中,例如:

0 投票
1 回答
2908 浏览

php - Trying to save file from Flash to PHP using $GLOBALS["HTTP_RAW_POST_DATA"]

Let me start by saying PHP isn't my forte, I'm usually reluctant to try working with it because of problems exactly like this. The code works fine on my local machine under MAMP and on my server, but doesn't on the clients server :'(

So what am I trying to do, well - save an image from Flash onto the server, simple right?!

I'm using the method described on this site here: http://designreviver.com/tutorials/actionscript-3-jpeg-encoder-revealed-saving-images-from-flash/ but have made a small alteration so that instead of echoing the jpg causing the browser to download it locally, I do an fwrite and an fclose to save it to the server.

Here is my PHP:

I've dona a phpinfo() on my clients server and it's running 5.2.2 my host is running 5.2.11 I don't know if much can have changed in those 9 minor revisions?

I've also read another question on here which suggests making suer always_populate_raw_post_data is set to ON, but it's set to OFF on all of the server environments I've been testing in. I'm doing some XML saving using file_get_contents('php://input') which I've tried but failed to get working with images.

Any help would be gratefully received, I'm happy to post the AS3 as well but it's EXACTLY the same as example I've linked above and works locally. As far as I can tell the problem lies with the PHP.

Cheers.

0 投票
1 回答
189 浏览

c++ - 使用 dlopen 加载的插件之间是否共享运行时链接库全局变量?

我有一个 C++ 程序,它在运行时与 mylib.so 链接。然后,同一个程序使用 dlopen()/dlsym() 从 myplugin.so 加载一个函数,动态库又依赖于 mylib.so。

我的问题是:程序和插件中的函数是否会在为程序保留的同一内存区域中访问 mydlib.so 中定义的相同全局变量,或者每个将在其自己的内存空间中分配不同的、不相关的副本?如果后者是默认行为,是否可以更改它?

提前感谢=)!

0 投票
7 回答
42010 浏览

iphone - Objective C 定义 UIColor 常量

我有一个 iPhone 应用程序,为我的主题提供了一些自定义颜色。由于这些颜色将为我的 UI 固定,因此我想在要包含的类中定义颜色(Constants.h 和 Constants.m)。我怎么做?(简单地定义它们不起作用,因为 UIColors 是可变的,并且会导致错误 - Initalizer 不是常量)。

谢谢!