Forum poświęcone PHP
Mam taki kod: class A { }; class B : public A { }; Czy da się zrobić tak, aby w programie nie można było utworzyć obiektu klasy A?
Sun,04 Jan 2009 01:42:01 +0100
witam mam banalny problem ale jakos nie potrafie sobie z nim poradzic [glowa] [wstyd] chodzi o to, ze w programie mam wyszukiwanie w czasie rzeczywistym: jak tylko zaczynam cos wpisywac do edita to wyszukiwane sa odp rzeczy. problem w tym, ze jesli wyszukiwanie trwa a ja cos zmienie w edicie to wyszukiwanie ma zostac przerwane a nast rozpoczete na nowo. no i wlasnie z tym mam problem, z zatrzymaniem i jednoczesnym rozpoczeciem nowego. help [glowa] dzieki z gory
Sun,04 Jan 2009 01:23:45 +0100
Witam :) Chciałbym prosić o pomoc w rozpracowaniu kodu programu. Jest to saper napisany poprzez tablice dwuwymiarowe, których wartości ja zdefiniowane globalnie. Program znalazłem w zwykłym C i przerobiłem go na polskie określenia oraz na język c++. Powyrzucałem też nieco zbędnych linijek kodów zastępując łatwiejszymi rozwiązaniami oraz wprowadziłem generator losowych bomb ;) Generalnie rzecz biorąc rozumiem co nieco funkcji, ale chciałbym się upewnić co do moich domysłów. #include "stdafx.h" #include #include #include #include using namespace std; const int lw=7; const int lk=7; const int lb=1; int tab_bomb[lw][lk]; int tab_krycie[lw][lk]; int otoczenie_bomb[lw][lk]; int pozostale_pola; int Zaleznosc(int wiersz, int kolumna) //do sprawdzenia poprawnosci wprowadzonych wspolrzednych { return wiersz>=0 && wiersz=0 && kolumna
Sun,04 Jan 2009 01:14:49 +0100
Mam mały problem, tworzę dynamicznie tablice dwuwymiarowa char i chcę do niej wpisywać wyrazy gdzie w każdym wierszu będzie inny, a gdy wcisnę 0 to się wpisywanie zakończy. Ilości wyrazów jakie zostaną wpisane do tablicy nie znam więc używam zmiennej ilosc_wyrazow jako licznika ich. I mój problem jest następujący nie wiem gdzie wsadzić licznik wyrazów aby je zliczał oraz aby dobrze się tekst kopiował do tablicy dwuwymiarowej z tablicy pomocniczej. #define DLUGOSC_WIERSZA 50 int ilosc_wyrazow = 1 ; char tab_pomocnicza[50] ; tablica = (char**)malloc(DLUGOSC_WIERSZA * sizeof(char*)); for(i = 0; i < DLUGOSC_WIERSZA; ++i) { tablica[i] = (char*)malloc(ilosc_wyrazow * sizeof(char)); scanf("%s", tab_pomocnicza) ; if(tab_pomocnicza[0] == '0') { break ; } strcpy(tablica[i], tab_pomocnicza) ; } Jak narazie doszedłem do tego i kod mi wybucha, w grę wchodzi tylko ANSI C
Sun,04 Jan 2009 01:12:31 +0100
Problem to pewnie wina złych pomysłów... Ale w skrócie, mam klasę bazową będącą teoretycznie robolem oraz klase niby interfejsu wyższego poziomu. Obie te klasy to szablony. Trudno opisać cały ten bałagan, w każdym razie kod przykładowy wygląda tak: template class BaseW { protected: T work(T a, T b) { /*tu żyją smoki*/}; public: BaseW(){/*tu składają jaja smoki*/}; ~BaseW(){/*tu giną smoki*/}; } template Class WHorse: private BaseW { protected: typedef T (BaseW::*wrk)(T,T); map workers; public: WHorse() { workers['a']=BaseW::work; //
Sun,04 Jan 2009 00:00:25 +0100
PUT method support
PHP provides support for the HTTP PUT method used by some clients to store files on a server. PUT requests are much simpler than a file upload using POST requests and they look something like this:
This would normally mean that the remote client would like to save the content that follows as: /path/filename.html in your web tree. It is obviously not a good idea for Apache or PHP to automatically let everybody overwrite any files in your web tree. So, to handle such a request you have to first tell your web server that you want a certain PHP script to handle the request. In Apache you do this with the Script directive. It can be placed almost anywhere in your Apache configuration file. A common place is inside a <Directory> block or perhaps inside a <Virtualhost> block. A line like this would do the trick:
This tells Apache to send all PUT requests for URIs that match the context in which you put this line to the put.php script. This assumes, of course, that you have PHP enabled for the .php extension and PHP is active. The destination resource for all PUT requests to this script has to be the script itself, not a filename the uploaded file should have.
With PHP 4 and following you would then do something like the following in your put.php. This would copy the contents of the uploaded file to the file myputfile.ext on the server. You would probably want to perform some checks and/or authenticate the user before performing this file copy.
Notatka: All documentation below applies to PHP 3 only.
The only
trick here is that when PHP sees a PUT-method request it stores
the uploaded file in a temporary file just like those handled by
the POST-method.
When the request ends, this temporary file is deleted. So, your
PUT handling PHP script has to copy that file somewhere. The
filename of this temporary file is in the $PHP_PUT_FILENAME
variable, and you can see the suggested destination filename in
the $REQUEST_URI (may vary on non-Apache web servers). This
destination filename is the one that the remote client specified.
You do not have to listen to this client. You could, for example,
copy all uploaded files to a special uploads directory.
| Poprzedni | Spis treści | Następny |
| Uploading multiple files | Początek rozdziału | Korzystanie ze zdalnych plików |